I came across a useful snippet of code that I wanted to pass on and post about. It detects whether the person viewing your website is on a iPhone or computer. If they are on a iPhone, you can redirect them to a iPhone version website or just to another page, its up to you. If they are on the computer it doesn’t redirect them and they go on as normal. Its just some simple javascript, and if you want to use it just change the “document.location” value to the url you want them redirected.
1 2 3 4 5 | <script type="text/javascript">// <![CDATA[ if ((navigator.userAgent.indexOf('/iPhone/i') != -1) || (navigator.userAgent.indexOf('/iPod/i') != -1)) { document.location = "http://www.scottrockers.com/iphone.html"; } // ]]></script> |
Cya











