Problem with history back java script

Asked

Viewed 174 times

1

I have a page, called page 1.php of registration that when you click on a confirm button it takes me to page 2.php, which performs all operations in the bank, but at the end of the page has a code like this:

echo "<script language='javascript'>
    history.back();
</script>";

Ai gives a request problem as follows:

Confirm resubmission of the form

  • I want to simply go back to the previous page, that’s it. I have more information about the error, it appears this: ERR_CACHE_MISS.

1 answer

3


When you use the history.back() the behavior is similar to clicking the return button of the browser, why it asks you to confirm the resubmission of the form.

If you want to go back to page 1 you were before, you can manage the URL this way

echo "<script language='javascript'>
    window.location.href = 'URL da página anterior';
</script>";

If your previous page is dynamic, you need to deal with which return page will be with a logic. Use history back is not a good practice

  • Thanks, I didn’t know it would be bad practice to use history back, work with other languages besides javascript so sometimes I let slip a few things like this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.