最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using modernizr to detect iOS devices - Stack Overflow

programmeradmin2浏览0评论

So i'm trying to download a image, I use window.location = data.url; which points to the file the image however, in iOS it sends it to the actual image where you need to tap and hold to save.

I know there's no way around this however, I feel it breaks the journey so wanted to just direct them to another page I create with the image and text saying "tap and hold" so the user knows.

I had a look at the documentation but got lost. How can I detect if someone is using an iOS device?

So i'm trying to download a image, I use window.location = data.url; which points to the file the image however, in iOS it sends it to the actual image where you need to tap and hold to save.

I know there's no way around this however, I feel it breaks the journey so wanted to just direct them to another page I create with the image and text saying "tap and hold" so the user knows.

I had a look at the documentation but got lost. How can I detect if someone is using an iOS device?

Share Improve this question asked Mar 30, 2016 at 11:05 pourmesomecodepourmesomecode 4,36812 gold badges53 silver badges91 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Modernizr is all about feature detection, not device/browser detection via UA string sniffing.

Device/browser detection is a bad guy for some time and it's unlikely for this to change - it's been proved that it is unreliable for multiple reasons.

However, if you are determined to go this way, I can suggest you to check out isMobile - a simple javascript lib for mobile device detection.

发布评论

评论列表(0)

  1. 暂无评论