Home > Web Front-end > HTML Tutorial > Warn before page refresh or close_html/css_WEB-ITnose

Warn before page refresh or close_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:50:48
Original
1207 people have browsed it

Sometimes in order to prevent the user from accidentally clicking refresh or closing the page, the edited content is not saved, and to give the user more choices, the following events can be added

onbeforeunload="window.event.returnValue" ='The content is not saved, dear'"

The display effect in IE is as follows:

The display effect in Chrome is as follows:

Window.event.returnValue=false; used to stop event processing.

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