Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using modernizr to detect iOS devices

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?

like image 327
pourmesomecode Avatar asked Mar 30 '16 11:03

pourmesomecode


1 Answers

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.

like image 149
Miloš Đakonović Avatar answered Oct 20 '22 11:10

Miloš Đakonović