admin管理员组文章数量:1321245
In Firefox, the following code works correctly when run in the main browser thread as normal--
var fr = new FileReader();
..but when run from a web worker, the following error is thrown:
FileReader is not defined
The same code works fine in Chrome and Safari.
Any suggestions for supporting FileReader in a web worker in Firefox?
In Firefox, the following code works correctly when run in the main browser thread as normal--
var fr = new FileReader();
..but when run from a web worker, the following error is thrown:
FileReader is not defined
The same code works fine in Chrome and Safari.
Any suggestions for supporting FileReader in a web worker in Firefox?
Share Improve this question asked Mar 30, 2014 at 7:35 Stu BlairStu Blair 1,3431 gold badge16 silver badges24 bronze badges 3-
1
Did you try using
FileReaderSync
instead ofFileReader
? – adeneo Commented Mar 30, 2014 at 8:08 - @adeneo, yes, that does appear to be supported. Does FF not support asynchronous file reading? Are chrome/safari actually operating synchronously when I use FileReader? – Stu Blair Commented Mar 30, 2014 at 9:14
-
1
Well,
FileReaderSync
is only supported in workers, as you generally don't need asynchronous file reading in a worker, but I'm not sure why Firefox doesn't support the regular asyncFileReader
in worker, I thought they did, but at least they support the synchronous version, so you can just use that as you don't need async behaviour in a worker anyway. – adeneo Commented Mar 30, 2014 at 9:17
1 Answer
Reset to default 7As adeneo pointed out, it seems that FileReader
is simply not supported by Firefox in Web Workers. I was able to use FileReaderSync
instead to acplish what I needed.
本文标签: javascriptFirefoxquotFileReader is not definedquot only when called from Web WorkerStack Overflow
版权声明:本文标题:javascript - Firefox -- "FileReader is not defined" only when called from Web Worker - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742096650a2420592.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论