Reputation: 95
Is this possible to open jquery popup when onbeforeunload event call?
Please check in image url here I have html content with one button and google link. Now when I click on tab or window close I need to display jquery popup under window confirmation box for leave or stay on page.
http://staging.jigmogroup.com/dvs/win_confirm.png
Finally I made solution Here:
I got solution its possible we can able to call javascript function not jquery. like
var leave_message = 'You sure you want to leave?'
function goodbye() {
//load popup
loadPopup();
centerPopup();
return leave_message;
}
window.onbeforeunload=goodbye;
We can able to call javascript function not jquery so its working
Upvotes: 2
Views: 887
Reputation: 191749
No it's not possible.
onbeforeunload
can only return a string that is alerted in a native browser alert window and gives the user the option to continue or not. In fact, Firefox won't even print out this string.
Upvotes: 1