I got this for IE browsers,
var IE = /*@cc_on!@*/false;
if (IE) {
// IE.
} else {
// Others.
}
but how would i do the same for iphone/ipad/mobiledevices? (do not want to redirect to another page on any mobile devices)
I got this for IE browsers,
var IE = /*@cc_on!@*/false;
if (IE) {
// IE.
} else {
// Others.
}
but how would i do the same for iphone/ipad/mobiledevices? (do not want to redirect to another page on any mobile devices)
You may want to check the user agent string as follows:
var userAgent = navigator.userAgent;
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
// iPad or iPhone
}
else {
// Anything else
}
That should be a bit of a problem because every app makes its own Header. My apache server gets this as Browser: [APPNAME]/1.0_CFNetwork/459_Darwin/10.3.0
You could search for Darwin, but i don't know if this is waterproof.
A JS-Snippet should look like that:
if (navigator.userAgent.indexOf("Firefox") != -1){ document.write('You're using Mozilla Firefox'); }
greets Simon