WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#19444 new defect (bug)

Widgets page stale when pressing the Back button

Reported by: willshouse Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Widgets Keywords:
Focuses: Cc:

Description

For several versions of Wordpress (maybe all of them), I've noticed that the Widgets page can be loaded from cache:

http://img51.imageshack.us/img51/725/pictureen.png

I'm not sure why this is happening, when the page is first loaded headers are sent including no-cache, must revalidate, max-age=0, all of which seems to be done correctly:

http://img703.imageshack.us/img703/4526/screenshotwithshadow.png

However, if I load the widgets page, make a change to the order of the widgets, then navigate to another page, and then use the back arrow to go back to the widgets page, a cached version of the widgets page (pre-change) is loaded. This can be especially troublesome if you spend a lot of time making changes and adding and removing widgets, or widget content, then go back to the page and make another change before you realize that the cached page is loaded, because it will overwrite all the changes that you had just previously spent so much effort on.

One possible solution would be to load all the widgets with AJAX if javascript is available, or possibly re-check that the correct widgets are in place with AJAX after the page loads (and use Javascript to reload the page again if they are not). The latter method would also enable the page to be loaded using standard methods if Javascript was not enabled.

Change History (3)

comment:1 scribu3 years ago

  • Component changed from Cache to Widgets
  • Summary changed from Widgets page to Widgets page stale when pressing the Back button

This is because when you click "Back", no sane browser re-loads the page again. It just serves the page as it was last loaded, but without the DOM modifications made through JavaScript. So it's not a problem with our caching headers.

This is another reason why it's planned to make the widgets page act more like the menus page: you have to click Save for the changes to take effect, which would also cause a new page load.

comment:2 azaozz3 years ago

This is a problem for all screens that are updated with ajax and also for screens where the content can change after the user navigates away and before pressing the back button. Examples: the Categories, Tags, Comments, Dashboard screens. If comments are posted before the user presses the browser's back button, they won't show.

Adding a "Save" button to all these screens is not a good idea imho, not possible for the Dashboard anyways. Thinking we should explore other options. It seems there is a way to force the browser to reload the (already rendered) screen from the server when the Back button is pressed, at least for newer browsers.

Note: See TracTickets for help on using tickets.