Skip to content Skip to sidebar Skip to footer

Inline Webworker: Uncaught Syntaxerror: Unexpected Identifier

I have created an inline webworker as follows: var blob = new Blob([document.querySelector('#worker').textContent]); var worker = new Worker(window.URL.createObjectURL(blob)); How

Solution 1:

First error is caused by a simple typo in your fiddle, you had:

newBlob([document.querySelector("#worker")]);

But you needed:

newBlob([document.querySelector("#worker").textContent]);

The warning about your mime-type can be solved by setting the type on the blob when you create it:

new Blob([document.querySelector("#worker").textContent],
            {type: 'text/javascript'});

http://jsfiddle.net/9u45Q/6/

Edit: Fixed type.

Post a Comment for "Inline Webworker: Uncaught Syntaxerror: Unexpected Identifier"