Home > Web Front-end > JS Tutorial > Disable browser backing to prevent repeated submissions through location.replace_javascript tips

Disable browser backing to prevent repeated submissions through location.replace_javascript tips

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:37:12
Original
1402 people have browsed it

In web design, it may be necessary to disable the browser's back button due to certain needs, especially for some websites that are strict on user operations. If the user repeatedly submits events and then backs off, this may affect some data. create catastrophic problems. So today I will introduce to you a method to disable the browser back button through location.replace.

The principle of this method is to replace the current history record with the URL of the new page, so that there is only one page in the browsing history, the back button is always inactive, and the user cannot go back. The specific usage is as follows:

①For example, now I want to make a hyperlink. This link links to the page htmer.htm. The code is as follows:

<a href="#" onclick="location.replace('htmer.htm')">链接</a>
Copy after login

② If a button is used for hyperlinking, the code that also links to the page htmer.htm is as follows:

<input type="button" value="提交" onclick="location.replace('htmer.htm')">
Copy after login
Related labels:
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
Latest Issues
mysqldump without specifying location
From 1970-01-01 08:00:00
0
0
0
web - nginx location search algorithm problem! ?
From 1970-01-01 08:00:00
0
0
0
nginx location matching problem
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template