Skip to content

Instantly share code, notes, and snippets.

@mohsinworld
Last active October 8, 2019 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohsinworld/1d4c1352061f04e9ae3a3c502d8bf7f7 to your computer and use it in GitHub Desktop.
Save mohsinworld/1d4c1352061f04e9ae3a3c502d8bf7f7 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "https://mohsinalam.com/mobile/";
}
//-->
</script>
"https://mohsinalam.com/mobile/" would be replaced with the location of wherever your mobile version resides. This technique could be adapted to load an alternate stylesheet as well.
For iPhones/iPods Specifically
<script language=javascript>
<!--
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("https://mohsinalam.com/iphone/");
}
-->
</script>
To PC redirect to main homepage
<script type="text/javascript">
<!--
if (screen.width >= 699) {
document.location = "https://mohsinalam.com";
}
//-->
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment