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

Warn before page refresh or close_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:50:481192browse

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.

Statement:
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