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));

However I am getting an error:


Uncaught SyntaxError: Unexpected identifier


Also a note saying:

Resource interpreted as Script but transferred with MIME type text/plain: "blob:http%3A//fiddle.jshell.net/7284b49c-b4a5-4523-8a06-bbf98cd7e03f".

What am I missing?

<a href="http://jsfiddle.net/9u45Q/1/" rel="nofollow">jsFiddle</a>

<strong>UPDATE</strong>: Fiddle: <a href="http://jsfiddle.net/9u45Q/2/" rel="nofollow">http://jsfiddle.net/9u45Q/2/</a>

The error occurs when you are filling the form and you reach to the Number of Tickets field


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

new Blob([document.querySelector("#worker")]);

But you needed:

new Blob([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'});

<a href="http://jsfiddle.net/9u45Q/6/" rel="nofollow">http://jsfiddle.net/9u45Q/6/</a>

Edit: Fixed type.


  • Run python script inside powershell script
  • In C,why is definition of a global variable in a separate statement raising warning,but is OK for a
  • Cleave.js Phone CA
  • Why are `colMeans()` and `rowMeans()` functions faster than using the mean function with `lapply()`?
  • jQuery file download plugin
  • Understanding Intl.DateTimeFormat as a JavaScript object
  • 'include' of functions in groovy scripts
  • How many Vertica Databases can run on a Host in the same time?
  • Can XOR be expressed using SKI combinators?
  • Extending the Django 1.11 User Model
  • Connecting bluetooth device to windows phone 8 application
  • google maps autocomplete bounces back already cleared text …odd…odd…odd
  • Best practice to eliminate magic numbers within a member function
  • How can I make this modal persistent?
  • In Java, how can I construct a File from a resource?
  • Getting error 'Cannot read property 'document' of undefined' while importing exp
  • quiver not drawing arrows just lots of blue, matlab
  • CXF JAXB JAXBEncoderDecoder unmarshalling error : unexpected element when having qualified elements
  • Unexpected token ILLEGAL while running node.js mocha test
  • How to print columns containing value
  • Sending keystrokes/mouse clicks to a Java program with Autohotkey
  • Elasticsearch script query involving root and nested values
  • Execute scripts AJAX returns
  • Check for zero lines output from command over SSH
  • JBoss External Properties Files in Classpath
  • What and where is mdimport
  • How do I open a C file with a relative path?
  • How to install a .deb file on a jailbroken iphone programmatically?
  • DomPDF {PAGE_NUM} not on first page
  • QLineEdit password safety
  • Javascript simulate pressing enter in input box
  • Launch Runnable Jar from Web Start
  • Validaiting emails with Net.Mail MailAddress
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • Javascript + PHP Encryption with pidCrypt
  • Importing jscolor library in angular 2
  • A cron job substitute?
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)