I have a scenario in which I need to detect whether the device is an iPod or iPhone. navigator.userAgent/navigator.platform doesn't have device information.
Here is what I use to detect iOS devices:
function is_little_ithing() {
return (navigator.userAgent.indexOf('iPod') > -1 ||
navigator.userAgent.indexOf('iPhone') > -1);
}
function is_big_ithing() {
return (navigator.userAgent.indexOf('iPad') > -1);
}
function is_ithing() {
return (is_little_ithing() || is_big_ithing());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.