Redirect Mobile Devices
<script type="text/javascript">// <![CDATA[
if (screen.width <= 699) { document.location = "mobile.html"; }
// ]]></script>
“mobile.html” 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 type=”text/javascript” language=”javascript”>// <![CDATA[
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { location.replace("http://url-to-send-them/iphone.html"); }
// ]]></script>
Did you like this? Share it: