Skip to content

Instantly share code, notes, and snippets.

@baopham
Created April 11, 2012 22:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baopham/2363199 to your computer and use it in GitHub Desktop.
Save baopham/2363199 to your computer and use it in GitHub Desktop.
Mobile Redirect js Snippets

Redirect Mobile Devices

<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->
</script>
<script language=javascript>
<!--
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
   location.replace("http://url-to-send-them/iphone.html");
}
-->
</script>

source: http://css-tricks.com/snippets/javascript/redirect-mobile-devices/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment