Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Learn More

I cannot get the browser to reload a JavaScript file.

  • 6 Antworten
  • 5 haben dieses Problem
  • 1094 Aufrufe
  • Letzte Antwort von Spector

more options

Firefox 48.0 on Ubuntu (Virtual Box guest machine on Windows 7 host). I have searched long and hard all over the net and cannot find anything that works. The js is in shared windows folder, mounted within Ubuntu, as is the whole web app. Generally the app works fine, but if I have to tweak a Java Script, the browser will not use the new file. I have tried:

  • Developer web console is open and "Disable Cache" is checked.
  • ctrl-r
  • ctrl-shift-r
  • ctrl-F5
  • Holding own shift when pressing the browser reload button.
  • Going to Menu|Preferences|Advanced|Network and pressing [Clear Now]

I am using a framework so I cannot add a version/timestamp on the end of the script file name.

The only way I have found that works so far is to shutdown the machine and bring it up again. That takes a long time for a simple script tweak/test to show up. It is wasting a LOT of my time...

Please, is there a faster, easier way to get Firefox to use that new file?

Firefox 48.0 on Ubuntu (Virtual Box guest machine on Windows 7 host). I have searched long and hard all over the net and cannot find anything that works. The js is in shared windows folder, mounted within Ubuntu, as is the whole web app. Generally the app works fine, but if I have to tweak a Java Script, the browser will not use the new file. I have tried: *Developer web console is open and "Disable Cache" is checked. *ctrl-r *ctrl-shift-r *ctrl-F5 *Holding own shift when pressing the browser reload button. *Going to Menu|Preferences|Advanced|Network and pressing [Clear Now] I am using a framework so I cannot add a version/timestamp on the end of the script file name. The only way I have found that works so far is to shutdown the machine and bring it up again. That takes a long time for a simple script tweak/test to show up. It is wasting a LOT of my time... Please, is there a faster, easier way to get Firefox to use that new file?

Geändert am von Spector

Ausgewählte Lösung

I finally got this figured out. By adding a line to my nginx server block it is now working . The line:

sendfile off;
It seems because the script file was on the host, not the guest and in a mounted shared directory there were issues with nginx 'knowing' the state of the file.

In case others need this, there were other symptoms that at the time I did not realize were connected. After editing the file:

  • The file has illegal characters appended
  • The file would have syntax errors
  • The file would be truncated
Diese Antwort im Kontext lesen 👍 0

Alle Antworten (6)

more options

No one can help? I am wasting hours rebooting to get the script to update as I debug the script.

more options

That's hard to understand. Is it possible there is some kind of external caching?

What if you load the .js in its own tab and Ctrl+Shift+r there -- any difference in behavior from when it is linked into a page?

more options

Loading the js in its own tab, I see the file contents listed. If I update the js in my editor on the host and then press Ctrl+Shift+r, the file listing does get updated.

more options

Bizarre. So even after clearing the cache, or disabling the cache in devtools, or bypassing the cache on reload, the main page gets the old external .js but loading the .js stand-alone and bypassing the cache gets the new .js. Is there any difference other than the HTTP_REFERER between those requests? I can't think of what it would be, or why that would matter.

more options

I just saw a reference to this add-on as helping with "stuck" cached files:

https://addons.mozilla.org/firefox/addon/clear-site-cache/

Haven't tried it myself.

more options

Ausgewählte Lösung

I finally got this figured out. By adding a line to my nginx server block it is now working . The line:

sendfile off;
It seems because the script file was on the host, not the guest and in a mounted shared directory there were issues with nginx 'knowing' the state of the file.

In case others need this, there were other symptoms that at the time I did not realize were connected. After editing the file:

  • The file has illegal characters appended
  • The file would have syntax errors
  • The file would be truncated