title: Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope'
body: <p>I am trying to import json data from web worker using <code>importScripts</code>, the following error occurs.</p>
  <blockquote>
  <p>Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at (my:URL to fetch data from server) failed to load.</p>
  </blockquote>
  <p>Web worker code is here. I am able to send basic messages from my web worker thread and main js thread. I want to fetch jsonp data from my server from web worker thread and then reply to main js thread.</p>
  <pre><code>/*web worker js file to fetch json data from server and then return to main javascript thread*/
  
  self.onmessage = function(e)
  {
      var curr = setInterval(function()
      {
      
           var message = e.data;     
              fetchMyTournament(message);
      
      }, 10000);
  }
  
  
  
  function fetchMyTournament(userid)
  {
      self.postMessage('worker saying hi');
         
      
      var url = &quot;(server URL mapping)?callback=processInfo&amp;type=(typeOfArgument)&amp;userId=&quot;+userid;
      
                 
                 
                 importScripts(url);
              self.postMessage(&quot;After import script&quot;);
  
              
         
  }
  function processInfo(objJSON) 
  {
   
      self.postMessage(&quot;Data returned from the server...: &quot; 
                    + JSON.stringify(objJSON));
  } 
  </code></pre>