Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Den här webbplatsen har begränsad funktionalitet medan vi utför underhåll för att förbättra din upplevelse. Om en artikel inte löser ditt problem och du vill ställa en fråga har vi vår gemenskap som väntar på att hjälpa dig på @FirefoxSupport på Twitter, /r/firefox på Reddit.

Sök i support

Akta dig för supportbedrägerier: Vi kommer aldrig att be dig att ringa eller skicka ett sms till ett telefonnummer eller dela personlig information. Rapportera misstänkt aktivitet med alternativet "Rapportera missbruk".

Läs mer

I cannot get the browser to reload a JavaScript file.

  • 6 svar
  • 5 har detta problem
  • 1 visning
  • Senaste svar av 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?

Ändrad av Spector

Vald lösning

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
Läs svaret i sitt sammanhang 👍 0

Alla svar (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

Vald lösning

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