Home > Web Front-end > JS Tutorial > js leave or refresh page detection (and compatible with FF, IE, Chrome)_javascript skills

js leave or refresh page detection (and compatible with FF, IE, Chrome)_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:57:10
Original
1376 people have browsed it
Copy code The code is as follows:




<script><br> function closeIt()<br> {<br> return "Any string value here forces a dialog box to n" <br> "appear before closing the window." ;<br> }<br> window.onbeforeunload = closeIt;<br></script>


Click here to navigate to
      www.jb51.net




Compatible with FF, IE, and Chrome js detection for leaving or refreshing the page, the key part is to have return
Related labels:
js
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