Home > Web Front-end > JS Tutorial > Js simple implementation of returning to the previous page with a concise introduction

Js simple implementation of returning to the previous page with a concise introduction

韦小宝
Release: 2018-02-03 09:48:40
Original
1854 people have browsed it

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); //刷新上一页
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template