Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(onbeforeunload): an unsafe, cross-compatible hack to workaround #467
This hack is needed to address <#467> because [Dom.handler] <https://ocsigen.org/js_of_ocaml/latest/api/js_of_ocaml/Js_of_ocaml/Dom/index.html#val-handler> appears to be incompatible with "onbeforeunload" and Firefox. * Namely, the semantics of [Dom.handler] requires to "return true" to tell [Dom.handler] that we want to unload normally, * but with some browsers such as Firefox we should actually "return undefined" (better than "return null" BTW), * but then, "undefined" is seen as "false", implying [Dom.handler] will call "preventDefault", * end_of_the_story. Credits: the working code from this commit reuses a patch by @leunam217, pfitaxel@15780b5 See also: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#example
- Loading branch information
Showing
3 changed files
with
50 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters