Detecting Device for website
I'm creating a website wi开发者_JS百科th Flash embedded into it. I understand that iPads do not support flash. I also have a non-flash version ready only to be used for iPad users. How do I detect the end user's device and redirect them to the version directly ?
Assuming you're checking this from the website, you could use the following JavaScript code;
function isiPad() {
return (navigator.platform.indexOf("iPad") != -1);
}
So, for example, you could add something like this to onload
if(isiPad()) window.location = "http://mysite.com/ipad";
Detect iPad users using jQuery?
精彩评论