搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Reload button doesnt refresh the page

  • 6 回覆
  • 3 有這個問題
  • 10 次檢視
  • 最近回覆由 bradp

more options

Hi, so I started learning to develop websites a while ago, and all was good. However, recently I've had an issue. When I make a change and I'd like to refresh the page, to see it how someone visiting for the first time would see it, the page reloads, however it's exactly the same. For example, I've got 2 buttons. When button 1 clicked, button 2 gets disabled. Refresh the page and... button 2 is still disabled. In other browsers, both buttons return to their "default state". Shift-clicking the reload button does in fact refresh the page as expected. But a normal click, even if the webpage was retrieved from cache, should at least refresh the page, right? I've tried refreshing firefox, so add-ons are not the issue, and this hasn't been an issue before, any help is appreciated.

Hi, so I started learning to develop websites a while ago, and all was good. However, recently I've had an issue. When I make a change and I'd like to refresh the page, to see it how someone visiting for the first time would see it, the page reloads, however it's exactly the same. For example, I've got 2 buttons. When button 1 clicked, button 2 gets disabled. Refresh the page and... button 2 is still disabled. In other browsers, both buttons return to their "default state". Shift-clicking the reload button does in fact refresh the page as expected. But a normal click, even if the webpage was retrieved from cache, should at least refresh the page, right? I've tried refreshing firefox, so add-ons are not the issue, and this hasn't been an issue before, any help is appreciated.

由 bradp 於 修改

被選擇的解決方法

As you have discovered, Firefox may retain and prefill cached form field values and other "page state" when redisplaying a page. I really appreciate that in recent months this site allows that.

If you want a "standard" reload (not holding shift) to default the fields back to their original values and status, you could try preventing Firefox from caching the page -- some developers have said this is difficult because Firefox is rather stubborn about flushing cached pages -- or hook a different event (pageshow) to clear the fields back to default values.

More info in this article: https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

從原來的回覆中察看解決方案 👍 0

所有回覆 (6)

more options

Any suggestions on this?

more options

Update: Still no response :(

more options

So sorry for the wait! Your thread slipped thru us somehow.

I was thinking this was caused by a addon that added web dev options to help you debug your site. But since you refreshed Firefox that can't be the case. Although you may have enabled a developer tool option that could be causing this problem like the disable cache setting. But I'm going to ask Jscher, a contributor with web dev experience to help us out here. I'm hoping he can help us figure out what's going on here.

You can really help us out by sharing the link to your site or making it publicly accessible so that we can try it out ourselves and see what might be wrong. Thanks! Btw what other browsers did you test your site in?

more options

選擇的解決方法

As you have discovered, Firefox may retain and prefill cached form field values and other "page state" when redisplaying a page. I really appreciate that in recent months this site allows that.

If you want a "standard" reload (not holding shift) to default the fields back to their original values and status, you could try preventing Firefox from caching the page -- some developers have said this is difficult because Firefox is rather stubborn about flushing cached pages -- or hook a different event (pageshow) to clear the fields back to default values.

More info in this article: https://developer.mozilla.org/Firefox/Releases/1.5/Using_Firefox_1.5_caching

more options

Hi, thanks for the responses https://bradleyphillips.co.uk/uni/example.html Is a basic example of what I'm trying to explain. When the start button is pressed the stop button gets disabled, but on page reload the stop button doesn't get re-enabled. In response to jscher2000, are you saying that I'll have to use javascript to refresh the page state on reload? Unfortunately I don't have time right now to read through the link, but I'll have a look in a few hours. Thanks again for the responses, Brad

more options

So I've just found some time to look through the link, and it seems to explain everything, thanks again, brad