Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returnValue should be set to a truthy value #33

Open
mgol opened this issue Mar 22, 2024 · 1 comment
Open

returnValue should be set to a truthy value #33

mgol opened this issue Mar 22, 2024 · 1 comment

Comments

@mgol
Copy link

mgol commented Mar 22, 2024

The Chrome fallback at

return (event.returnValue = '');
sets event.returnValue to an empty string. However, the confirmation dialog should only be shown when the value is truthy despite Chrome not following this part of the API:
https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event

While Chrome 119 and newer respects event.preventDefault() in beforeunload handlers, it'd be good to avoid using the API in an incorrect way and just set the value to a truthy one, e.g. 'true'.

@jacobbuck
Copy link
Owner

Good to know Blink/Chrome has fixed their implementation. I'll remove the fallback in a future version now that it's no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants