Quick question. I am writing a website and would like to redirect users to different webpages depending on their browser and also their version of the iPhone operating software. I know you may come back at me and say it should be up to the user to decide which site they view, they don’t have a choice in this matter.
The code I am using is in javascript and can identify between the different browsers but not the iPhone operating systems which is the key to this. This is the code:
if(navigator.userAgent.match(/iPhone/i)) {
if(navigator.userAgent.match(Version/4)){
if(document.cookie.indexOf("iphone_redirect=false") == -1) window.location ="iPhone4.html";
}
if(document.cookie.indexOf("iphone_redirect=false") == -1) window.location ="iPhone.html";
}
//Rest of the site goes here
Not sure if the brackets are right here it’s early and may have got that wrong but any help will be appreciated.
Sam
This should work: