Hello everyone please let know how to show a popup on hover when user close a browser . It's possible or not
Loading
Hello everyone please let know how to show a popup on hover when user close a browser . It's possible or not
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tuhin PaulPosted May 13, 2023, 3:14 AM
Unfortunately, it is not possible to show a popup on hover when the user closes a browser tab or window using the onbeforeunload or unload events, because for the two methods you need to return a string. Infact you cannot use your own dialog boxes (or jQueryUI modal dialogs) to override beforeunload method.
One option would be to use a service like Notify.js, which allows you to show notifications even when the user is about to close the browser.
Another option would be to use a browser extension like Stay.js, which prevents the user from closing the browser tab or window until they have dismissed the notification.
Check out this link:
https://stackoverflow.com/questions/52758117/how-to-display-popup-with-custom-html-on-browser-close-tab-using-javascript-jque
Deepak RawatPosted May 12, 2023, 10:56 AM
Jignesh KumarPosted Jan 16, 2023, 9:01 AM
Hello Anukesh,
You can use "beforeunload" to show pop up,
https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
Naimish MakwanaPosted Jan 16, 2023, 7:15 AM
There is no specific event for capturing the browser close event.
You can only capture on unload of the current page.
By this method, it will be effected while refreshing / navigating the current page.
Even calculating of X Y position of the mouse event doesn't give you good result.