I'm using the webkitdirectory attribute on my page for allow the user to upload a whole directory:
<input webkitdirectory type="file" />
This works great for Chrome, Firefox and Edge, but is unsupported for Internet Explorer. Is there a alternative in order to support IE?
3 Answers
Answers 1
Note these double meaning word from MSDN
For compatibility purposes, Microsoft Edge supports the webkitdirectory attribute.
Which says that only edge support webkitdirectory attribute
Also you can have a look at here to saw the IE input
support
https://msdn.microsoft.com/en-us/library/ms535263(v=vs.85).aspx
Answers 2
No, there will be no alternative if the browser itself does not support, as this is related to file system which javascript in webpage cannot reach.
One alternative is to use the multiple
attribute to upload multiple files (reference), but this still is only supported in IE10, and it won't keep the directory structure.
Answers 3
As you said, the functionality is not supported in IE and therefore you can't use it. I tried finding a polyfill for it but without success.
After reading
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
In the MDN website I wouldn't recommend you using this specific feature if you're developing anything but a test site for yourself.
0 comments:
Post a Comment