I am trying to put a script into the head of my site and have it automatically detect a mobile or screen size from the browser and redirect to a mobile friendly page.
I am using
I built a small test site to try it out at www.sigl.ws. It is nothing fancy and not a real site. It is strictly to test this script. The main page shows a laptop and the only two buttons that work are home and phone to see what the mobile page would look like.Code:<script type="text/javascript"> if(screen.width < 600){ window.location = "http://www.sigl.ws/Phone_Page.html"; } </script>
I cannot get it work with my android. What am I doing wrong?
Thanks
Edited----
I did try another script and it redirects great. Besides now building a smaller page to view, a new issue popped up on how to allow a mobile user view the main site without getting caught in a loop. I would also like to do this without a duplicate home page. The script I used was:
Thoughts?Code:<script type="text/javascript">// <![CDATA[ var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); if (mobile) { document.location = "http://www.mysitename.com/Phone_Page.html"; } // ]]></script>



Reply With Quote

Bookmarks