Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #773 from stucox/master

Added fileinput test mobile UA blacklist for issue #772
  • Loading branch information...
commit 612ed03c2d688ee8aa952e345b374509e0482c0e 2 parents a6f2cdf + 4dee9d5
@paulirish paulirish authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 feature-detects/forms-fileinput.js
View
5 feature-detects/forms-fileinput.js
@@ -1,5 +1,3 @@
-
-
// Detects whether input type="file" is available on the platform
// E.g. iOS < 6 and some android version don't support this
@@ -7,6 +5,9 @@
// don't support it (iphone, ipad, etc).
Modernizr.addTest('fileinput', function() {
+ if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0)|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|Pre\/1.2|Kindle\/(1.0|2.0|2.5|3.0))/)) {
+ return false;
+ }
var elem = document.createElement('input');
elem.type = 'file';
return !elem.disabled;

4 comments on commit 612ed03

@hallvors

While I will defend using browser sniffing to detect specific old versions that are known to have specific limitations .. Would perhaps something like

input.setAttribute('type', 'file')
var supported = input.type === 'file'

work?

@stucox
Owner

I don't think that will work @hallvors – the UA sniff is required because those browsers allow type=file, but it just doesn't work on the page – e.g. Android 1.x renders a normal file input which says "upload disabled" (to the DOM this looks like a normal functional file input).

@viljamis

@hallvors Unfortunately this does not help, for the same reasons @stucox above just explained.

Please sign in to comment.
Something went wrong with that request. Please try again.