I'm trying to create a HTML5 Web Worker in phonegap, but phonegap doesn't allow me to load a local javascript file at runtime. I get the following error:
var web_worker=new Worker('socket-worker.js')
undefined
file://socket-worker.jsFailed to load resource: The requested URL was not found on this server.
Does anyone have a good suggestion on how I can work around this, and get the worker running?
Thanks!
Haven't tried this yet but I believe we can run it using blob url. See it here ( http://www.html5rocks.com/en/tutorials/workers/basics/#toc-inlineworkers-bloburis )
Update: I've tried this already and it worked. :)
As per my knowledge Web Workers never works on local directory
file://
it works on server side. For example instead of placing files at "file://" so the path should be
***> http://localhost/ or***
***> http://server_ip_address***
Hence Phonegap consists of HTML and Javascript which are at device directory hence web workers are not supported in Phonegap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With