Skip to content

Instantly share code, notes, and snippets.

@sdthornton
Last active December 24, 2015 00:59
Show Gist options
  • Save sdthornton/6720490 to your computer and use it in GitHub Desktop.
Save sdthornton/6720490 to your computer and use it in GitHub Desktop.
For checking mobile browsers (covers 90% of all mobile browsers but doesn't cover mobile browsers pre-2004, which should be okay)
Step 1 (add script to <head>):
<head>
<script>/Mobile|Android|BlackBerry/i.test(navigator.userAgent)&&(document.documentElement.className+=" mobile_browser");</script>
</head>
Step 2 (add css declaration):
.link_to_show {
display: none;
}
.mobile_browser .link_to_show {
display: block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment