I've been trying to use web workers in Firefox 10. The example on the Mozilla site computes Fibonacci numbers (in this case, the 5th Fibonacci number - 5):
https://developer.mozilla.org/En/Using_web_workers#section_11
When I click the link to go to the example page: https://developer.mozilla.org/samples/workers/fibonacci/ I get the correct output of 5. When I copy and paste the source code into a new file on my desktop, along with the associated worker script (fibonacci.js), it won't work beyond the third number (ie worker.postMessage("3");). I've tried running it off my web server with the same result.
What might be the problem?
in the script, when n >=3, it spawns a new worker. But spawning sub workers isn't supported in Chrome/Safari yet.
https://developer.mozilla.org/en-US/docs/DOM/Using_web_workers#Spawning_subworkers
Which Browser are you trying it on ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.