lundi 25 juin 2018

Distinguish between a first GET and repeated GET after Back Button press

I'm working with an e-commerce website with configurable items. When a user arrives at the first step of an item configurator (with a GET request), it is assumed he is starting to configure a new item (instead of editing a previously configured item), unless the URL query string contains edit=1.

However, when the user is at step 2 and presses the browser Back Button, I also want the user to continue editing the configurable item instead of configuring a new item.

This is not an issue for step 3 and up, because when a user arrived at these steps, the requests are POSTs, and not GET.

How can I distinguish (server-side) between a user GET-requesting the first step for the first time, and when the browser Back Button has been pressed?

There seems to be a difference between the two GET requests when it comes to having Cache-control headers, but I haven't been able to reliably distinguish between the two based on that alone.

Note that the described behavior differs somewhat between browsers: Chrome and IE repeat the first GET request when the back button is pressed; Firefox seems to retrieve everything from cache without a request.




Aucun commentaire:

Enregistrer un commentaire