simonp Posted September 27, 2009 Share Posted September 27, 2009 Hi, I'm using this code to detect iPhone users to my website and then redirect them to their dedicated pages: if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) { document.location = "http://www.xxx.com/iphone/"; } But at the bottom of the iPhone site I want to offer a link back to the main site should they wish to view that rather than the dedicated iPhone site. I've seen it done like http://xxx.com/?noiphone which will then stop the redirect - but how might I include that in the javascript above? Thanks Simon Quote Link to comment https://forums.phpfreaks.com/topic/175715-solved-detecting-iphone-users/ Share on other sites More sharing options...
MadTechie Posted September 27, 2009 Share Posted September 27, 2009 untested but should atleate give you an idea if ( window.location.href.indexOf("noiphone") == -1 ){ if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) { document.location = "http://www.xxx.com/iphone/"; } } Quote Link to comment https://forums.phpfreaks.com/topic/175715-solved-detecting-iphone-users/#findComment-925997 Share on other sites More sharing options...
simonp Posted September 27, 2009 Author Share Posted September 27, 2009 Thanks MadTechie - that works a treat Cheers Quote Link to comment https://forums.phpfreaks.com/topic/175715-solved-detecting-iphone-users/#findComment-926007 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.