Does Google Chrome create a history item when redirecting?

When, after redirecting after submitting a form that returns to the page you are on, my experience has always been that clicking on your browser button will lead you to the page on which you were before the page before submitting the form.

For example, you enter a site and:

1. (click) GET /home 2. (click) GET /user/view 3. (click) POST /user/save_changes 4. (redirect) GET /user/view 

The behavior in Firefox is that after submitting and redirecting the form (# 4), pressing back will take you to # 1 (GET / home) from # 4. But in Chrome, clicking back after the redirect will take you to # 2 (GET / user / view).

I don’t remember that this was behavior in the past ... and this only happens in Chrome. This happens with both 301 and 302 redirects.

Is there any way to avoid this behavior? I always did this because the behavior was always acceptable (goes back to # 1 after clicking back after submitting the form). I did this so that someone would not click back and not receive the error message "You want to resend the form."

+4
source share
1 answer

HTML5 provides a great way to control browser behavior - the HTML5 history API. Guess, instead of processing independently, depending on the browser, it is always better to tell the browser how to handle it.

-1
source

Source: https://habr.com/ru/post/1400687/


All Articles