JavaScript is a language that has become very important with the new version of HTML5. Its uses are very varied and now we will see how to return to the previous page by reloading it.
When we use the function back () from JavaScript, we return to the previous website, but this one does not reload. This is a problem when we have come to this website from a form with a POST method, since the form data has to be sent again.
On this occasion, we will get an error of the type:
So that these types of errors do not occur, we have to return to said website by reloading it and therefore sending the form data again.
We will do this by specifying in the attribute href from the label to the next value
< to href = "window.location = document.referrer;" > To return < / to > |
The value
window.location = document.referrer; |
It takes care of returning to the previous page and avoiding the error of resending the form.
No Comment