@@ -724,16 +724,16 @@ propagate.
724
724
725
725
{{index "beforeunload event", "page reload", "preventDefault method"}}
726
726
727
- When a page is closed or navigated away from (for example, by following
728
- a link), a ` "beforeunload" ` event fires. The main use of this event is
729
- to prevent the user from accidentally losing work by closing a
730
- document. Preventing the page from unloading is not, as you might
731
- expect, done with the ` preventDefault ` method. Instead, it is done by
732
- returning a non-null value from the handler. When you do that, the
733
- browser will show the user a dialog asking if they are sure they want to
734
- leave the page. This mechanism ensures that a user is always able to
735
- leave, even on malicious pages that would prefer to keep them there
736
- forever and force them to look at dodgy weight-loss ads .
727
+ When a page is closed or navigated away from (for example, by
728
+ following a link), a ` "beforeunload" ` event fires. The main use of
729
+ this event is to prevent the user from accidentally losing work by
730
+ closing a document. If you prevent the default behavior on this event
731
+ _ and _ set the ` returnValue ` property on the event event object to a
732
+ string, the browser will show the user a dialog asking if they really
733
+ want to leave the page. That dialog might include your string, but
734
+ because some malicious sites try to use these dialogs to confuse
735
+ people into staying on their page to look at dodgy weight loss ads,
736
+ most browsers no longer display them .
737
737
738
738
{{id timeline}}
739
739
0 commit comments