Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

Reload button doesnt refresh the page

  • 6 réponses
  • 3 ont ce problème
  • 10 vues
  • Dernière réponse par 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.

Modifié le par bradp

Solution choisie

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

Lire cette réponse dans son contexte 👍 0

Toutes les réponses (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

Solution choisie

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