html5-Common Events-beforeunload events

Source: Internet
Author: User

When we visit certain websites on a daily basis, the following prompt appears when you close the current page:

  

Beforeunload event can be done, the event occurs: Before the page is unloaded, it can be canceled uninstall and continue to use the original page.

In order to display the above popup dialog box,

You must set event.returnvalue in IE Fiefox as the string to be displayed to the user; also returned as the return value of the function (for Safari and Chrome), the following example

     " Beforeunload ", Function (event) {        event = eventutil.getevent (event);         var " Are you sure you want to leave this page ? " ;         event. returnvalue = message;         return message;    });

IE, Firfox, Safari, Chrome all support beforeunload events. Not supported before OPERA11 version

html5-Common Events-beforeunload events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.