Does modernizr distinguish between image and file system access?

145 views Asked by At

I'm using Modernizr 3.0 to check for input[type='file'] so I don't show an upload button to users who can't use it. I'm worried that Modernizr.fileinput will return false for users who don't have file system access but do have camera access via

<input type="file" accept="image/*" />

I've tried checking this on browserstack but I'm still uncertain because I don't know how the various cameras respond on their VMs.

Does Modernizr distinguish between no file system access and no camera access or will Modernizr.fileinput return false if the user doesn't have file system access but does have camera access?

2

There are 2 answers

1
Mrchief On BEST ANSWER

You can use Modernizr.filesystem in conjunction with Modernizr.fileinput to see if the user has file system access.

Most desktop browsers support filesystem API, but mobile browsers don't. A weaker check would be Modernizr.filereader but it'll work on most mobile browsers (barring older ones such as IE9 and old Androids).

0
Patrick On

You can check out the detect here.

It doesn't distinguish against anything, other than a few blacklisted user agents (which modernizr does use, if there is no sane alternative).