The instance code is displayed on the close page implemented by jQuery. The jquery close page
The following code is displayed on the closed page of jQuery:
When you close the current page, if you can bring up a prompt, it is a very user-friendly action, because it can prevent misoperations, of course, it will also vary from person to person, because some viewers will feel more trouble, in any case, there is indeed such a requirement. Let's share the Code with this function.
The code example is as follows:
$ (Window). bind ('beforeunload', function () {return 'Are you sure you want to leave the current page ';});
When the above Code is refreshed or the browser page is closed, a prompt is displayed.
Browser compatibility:
1. Google Chrome works well.
2. Firefox has good results.
3. In IE browser, a prompt is displayed when the page is refreshed, but no prompt is displayed when the page is closed.
The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 9326.
For more information, see: http://www.softwhy.com/jquery/