Skip to content Skip to sidebar Skip to footer

Javascript: "uncaught Securityerror" When Running Js-xsl Demo Locally

(This question pertains to the JS-XSL demo found here) To briefly tell you what this demo is for; it takes a MS Excel file as input, parses the data, and outputs the data in text-o

Solution 1:

https://code.google.com/p/chromium/issues/detail?id=278883#c9

You are basically prevented by Chromium to use workers on the file:// protocol, you have to host your files and access them through the http:// protocol.

You need a server (even something simple like http://docs.python.org/2/library/simplehttpserver.html)

Solution 2:

IMO, the below is a superior answer, because it does not require running a web-server. It's extremely quick and simple.

(the downvote is explained in my Note 5, below)

I have tested and verified that this solution works with the demo linked by the asker, when run locally as described by the asker. Tested on Windows 10, Chrome Stable x64 48.0.2564.103 m.

A script is not allowed to access to your local file system in Chrome. If you'd like to test web workers locally, you have to open Chrome with a special flag.

On Windows, launch chrome with the flag:

chrome.exe --allow-file-access-from-files

After that Chrome will be launched and you can test workers during this session.

Note1: if Chrome is already running when you run this command, the new instance of Chrome will not allow Workers to run-- you must first exit from Chrome (if necessary, use Windows Task Manager to ensure Chrome is not running).

Note 2: the source for this answer (link below) includes the --args flag on Windows, but i have not found the "args" to be necessary on Windows. In fact, i cannot find any documentation of the "args" flag anywhere-- not sure what it does. So i don't include it in the Windows command, above.*

Note 3: For those trying to do something similar on Chrome-Mac, or Windows-Firefox, the link below includes both, along with the Windows-Chrome solution above. But my solution described above is only the Windows-Chrome method.

http://js-workout.tompascall.com/web-workers-and-responsiveness/

Note 4: Be aware that this solution is not the same as running a web-server, but for your purpose it should be a completely adequate solution. Also, be aware that to browse the web with this chrome startup-switch enabled may compromise your local file-security, so it's advised to only use this method for your local file purpose, and disable it for web-browsing.*

Note 5: Google states that using startup flags "should only be used for temporary cases and may break in the future." Web search for chrome startup switches returns about 2,000 hits, so lots of people use them and blog about them. If your need is temporary, then this currently works great.*

Post a Comment for "Javascript: "uncaught Securityerror" When Running Js-xsl Demo Locally"