I am trying to implement a 'web Workerto resolve a problem. However whenever I try to test the
Worker` to see if it exists, I keep getting back that Worker is 'undefined'.
Environment: Window 7.0, Visual Studio 2013, Internet Explorer 11, HTML 5. Application is MVC.
csHTML (I have substituted actual URLs and anchor text with generic square brackets "[ ]" for the sample code):
<a class="document-link" onclick="markLastVisitedCaseDocument([url]);
openDocument([url])">[anchor text]</a>
So the onclick
event fires two JavaScript functions. The first marks that the text was recently visited. The second (and the one I am having trouble with) opened the URL (which is a PDF document) in a PDF editor on the client. This works, but in production can take an extraordinary amount of time. I have been asked to implement a "please wait" message. However as JavaScript is single threaded I didn't see how to implement a 'wait' message and bring up the editor and document.
In my research I came upon two options: Web Worker (window.Worker) or HTML5 (which I believe allows multithreading of JavaScript). I would rather not implement HTML5 at this time given a limited time window for this fix. I have been trying to implement window.Worker
, but keep getting notice that it is 'undefined'.
At the moment I am just trying to get the Worker to 'work'. The code gives me the error that Worker is undefined.
function openDocument(url) {
var myWorker = new Worker("Worker.js);
This is not equivalent to [Are Shared WebWorkers supported in IE 11? as that user was trying to use Shared Web Workers and I am trying to use Web Workers. That user also accepted as best answer that Shared Web Workers are not supported in IE. I have read that Web Workers are supposedly supported.