IE和本地文件读取
我刚刚看过 mozilla File API 文件读取为
new FileReader();
等,我必须问 IE 是否有类似的东西?
I've just watched the mozilla File API file reading as
new FileReader();
etc. and I must ask is there something like that for IE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以使用ActiveX' FileSystemObject。但是,每次运行代码时,都会向用户显示一个确认框。某些用户可能不信任您,并且可能选择不运行 ActiveX 控件。
另请注意,有些用户还使用不支持 FileReader 的非 IE 浏览器(Safari、旧版本的 Firefox 等)。通过添加 ActiveX,您仍然无法获得对文件相关 API 的 100% 支持。
Yes, you can use ActiveX' FileSystemObject. However, an confirmation box is shown to the user everytime he runs the code. Some users might not trust you and could choose not to run the ActiveX control.
Also, please note that some users also use non-IE browsers which don't support FileReader (Safari, older versions of Firefox and so on). By adding ActiveX, you still won't have 100% support for file-related APIs.
Internet Explorer 10 还支持 FileReader:
对于托管有关 FileReader 的兼容性表,请务必查看 caniuse.com。
如果您想为那些可能不会在 Internet Explorer 10 中访问您的网站的用户提供后备方案,我建议您进行一些功能检测来确定是否要使用 FileReader:
另请注意使用 ActiveXObject 方法并不一定总是有效,因为某些用户使用 ActiveX Filtering 启用,含义您无法触及他们的文件系统,也无法在他们的浏览器中运行任何类型的插件。
Internet Explorer 10 also supports the FileReader:
For managed compatability tables regarding the FileReader, be sure to check out caniuse.com.
If you wanted to provide a fall-back for those who may not be visiting your site in Internet Explorer 10, I would encourage you to do a bit of feature-detection to determine whether or not you want to use the FileReader:
Note also that using an ActiveXObject approach isn't necessarily going to work all the time either as some users browse with ActiveX Filtering enabled, meaning you can't touch their file-system, or run any types of plugins in their browser.