Home > Article > Web Front-end > Js simple implementation of returning to the previous page with a concise introduction
The method of using JavaScript to return to the previous page is very simple and only requires one line of js code. Friends who don’t know much about js returning to the previous page can take a look and learn!
No more nonsense and go straight to the code:
window.history.go(-1); //返回上一页 window.history.back(); //返回上一页 //如果要强行刷新的话就是:window.history.back();location.reload(); window.location.go(-1); //刷新上一页
You read that right, that’s it. Isn’t it very simple to implement js to return to the previous page? ! Go wild, friends! !
Recommended reading:
JS return to top example sharing
This article mainly introduces the JS return to top example code in detail...
js Return to the previous page and refresh code organization
Return to the previous page and refresh This function is beneficial to the user experience and is a must for every web developer One item to prepare...
The above is the detailed content of Js simple implementation of returning to the previous page with a concise introduction. For more information, please follow other related articles on the PHP Chinese website!