title: Forcing a dynamically loaded javascript to not cache on google chrome
body: <p>I'm working on a google maps loader (using the google maps javascript API).  I want to dynamically add points to a path as and when they come available.  <strong>Edit</strong>: <em>The webpage and javascript are stored and loaded locally and not through a web server</em>.</p>
  
  <p>To this end I have created an external javascript file in which I put the data I want to use.</p>
  
  <p>I load the java script object using a great trick I found elsewhere on stackoverflow:</p>
  
  <pre><code>function loadjsfile( filename, callback )
  {
      var fileref = document.createElement( 'script' );
      fileref.setAttribute( "type", "text/javascript" );
      fileref.setAttribute( "src", filename );
  
      var done = false;
      fileref.onload  = fileref.onreadystatechange    = function()
      {
          if( !done &amp;&amp; ( !this.readyState 
                                  || this.readyState == "loaded" 
                                  || this.readyState == "complete") )
          {
                  done = true;
  
                  // Continue your code
                  callback();
  
                  // Handle memory leak in IE
                  fileref.onload = fileref.onreadystatechange = null;
                  document.getElementsByTagName( "script" )[0].removeChild( fileref );
          }   
      };
      document.getElementsByTagName( "script" )[0].appendChild( fileref );
  }
  </code></pre>
  
  <p>This works perfectly as it waits until the external javascript has actually loaded before proceeding with the intialisation.</p>
  
  <p>So thats all great it loads up fine.  I then set a 5 second timeout which reloads the external javascript file.  This is where I have an issue.  Google chrome is re-loading the external javascript file from cache instead of going straight to disk.  This is a huge pain as it means that my map path doesn't update as it goes along.  I really need it to.  </p>
  
  <p>When I refreshed the entire page then it was fine it reloaded the javascript but the flicker was very annoying (and it forced the map back to the "initial" state).  This new method would work perfectly provided I could force it to re-load the javascript file everytime.</p>
  
  <p>So can anyone help me?</p>
  
  <p>I'm very new to Javascript (I'm mainly a C++ coder) so apologies if I'm asking something stupid :D</p>