Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's all fun and games until we reflexively hit ctrl-w to close a virtual window and end up closing the browser tab that window is running in :/.


Definitely a `window.onbeforeunload = () => "Are you sure you want to close this browser tab"` missing, or override the keyboard input completely, so it doesn't try to close the tab.

Same problem exists for all browser shortcuts inside the OS.


> window.onbeforeunload = () => "Are you sure you want to close this browser tab"

besides the fact that now all browsers just display the uninformative "Your unsaved data may be lost" rather than any custom message, this would be a perfect addition.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: