Reputation: 13547
Why can't a javascript file in a WebWorker access document object, when a normal external javascript file can access the document object? Or can a WebWorker access a document object? Because in w3schools it is given that since webworkers are external javascript files, they cannot access the document object, window object, parent object.
Upvotes: 1
Views: 574
Reputation: 75777
It can't access the DOM because then browsers would have to add lots of complexity to ensure their DOM code was thread safe.
Upvotes: 4