navigate back with PHP form submission

后端 未结 6 831
旧时难觅i
旧时难觅i 2020-12-03 05:35

So here is the deal, I am using HTML forms to transfer variables from page to page and PHP script to create pages based on values submitted. In general it looks like this:

6条回答
  •  萌比男神i
    2020-12-03 06:02

    None of the other answers worked for me.

    • I don't want to redirect
    • Setting different headers didn't work
    • I already use tokens in my post to ensure re-submission can't happen
    • I post to the same url the form is showing on

    This simple javascript fixes my issue of the back button throwing "ERR_CACHE_MISS"

    if ( window.history.replaceState ) {
      window.history.replaceState( null, null, window.location.href );
    }
    

提交回复
热议问题