Having recently setup a mobile website to accompany our main corporate site I wanted to find a way of automatically redirecting all mobile traffic to the new site.
To do this I added the scripts below shown below.
<script type="text/javascript"> <!-- if (screen.width <= 699) { document.location = "mobile.html"; } //--> </script>
If you wanted to specifically target Iphone or Ipads then you could use the following
<script language=javascript> <!-- if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { location.replace("http://url-to-send-them/iphone.html"); } --> </script>
Advertisement