What's the best way to know if the running browser supports web-workers ?
is it
try { new Worker(); } catch (e) { /* it does not */ }
Thanks
This is the code the script Modernizr uses:
tests[webWorkers] = function () {
return !!window.Worker;
};
You can try window.Worker
in your browser's console to check if the function exists.
In your javascript code you can try this:
if (typeof(Worker) !== "undefined") {
//great, your browser supports web workers
} else {
//not supported
}
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