简体   繁体   中英

How to make history.back() without getting a warning on the browser to reload the page?

I need to create a "Back" button, so for that I used:

history.back();

It works fine when I run it locally, but when I deploy it to the server when I click on the button I get a message on the browser:

Confirm Form Resubmission
This webpage requires data that you entered earlier in order to be properly displayed. You can send this data again, but by doing so you will repeat any action this page previously performed.

Press the reload button to resubmit the data needed to load the page.
ERR_CACHE_MISS

There is no problem resubmitting the form. I just want to avoid this message for the user. Is there any way to do that?

最简单的解决方案(也是一般的最佳实践)是在POST提交后跟随成功重定向,该重定向会将用户带到可以通过直接URL访问的页面。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM