Flash alternative for FileReader HTML 5 API

守給你的承諾、 提交于 2020-01-09 11:20:20

问题


I want the content of a local text file to become available inside JavaScript. I've achieved that using HTML 5 FileReader API, but this works only in Mozilla Firefox and Chrome now.

I know that it is possible to create a cross-broswer solution using Flash. Is there any open-source project that do that?


回答1:


Here's an open source project which provides you with the FileReader API in older browsers via flash:

https://github.com/Jahdrien/FileReader




回答2:


Yes, it's possible. Use the FileReference.load method

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html#load%28%29

I don't know how it compares with the HTML5 API though. There are 2 requirements for the Flash version. It requires Flash Player 10 and you can't select a file automatically without opening a dialog box telling the user to select a file. Also, this dialog box can only pop up after a user interaction (click on a button, ...)

Example here :

http://actionsnippet.com/?p=1702



来源:https://stackoverflow.com/questions/5055724/flash-alternative-for-filereader-html-5-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!