• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic JS Return to previous page
#1
Hello.
So I have a website. There's a page which says: "internal error". And I want it to go back to previous one, to make the user not be confused of errors.
How do I do it?

window.history.back();

I know this function. It may help?
  Reply
#2
1. Better fix your errors, not hide error page XD
2. Yes, window.history.back(); is ok

You can use it like:

<body onload="returntoprevious()">
<script>
function returntoprevious() {
setTimeout(function(){ goBack(); }, 500);
}
function goBack() {
window.history.back();
}
</script>

Remember! The order of body and script is important!!!

Hope I helped Smile
Regards
Marcel
  Reply
#3
Yay,
Thank you soooo much. You saved my life Big Grin

Hope you have best things in the world

YeyRegards
marolion2000
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)