1

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.

2
  • 6
    Usually, w3schools is not a reliable source. You'd better use the Mozilla Developer Network instead. Commented Feb 23, 2012 at 10:34
  • WebWorker have access to the BOM. But for keeping them non-concurrent with the main script, which has access to the DOM, you canno't access the DOM. But why should someone even want to do this? Commented Jul 30, 2014 at 9:19

1 Answer 1

4

It can't access the DOM because then browsers would have to add lots of complexity to ensure their DOM code was thread safe.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.