Questions tagged [onunload]
198 questions
6
votes
5 answers
Don't have time to send get request on window unload
I want to notify the server on user closes browser window.
I tried all of the
$(window).bind("beforeunload", function() {
$.get("${contextPath}/notify?direction=logout");
});
and
$(window).unload( function() {
…

Dims
- 47,675
- 117
- 331
- 600
6
votes
4 answers
Can I pop up a confirmation dialog when the user is closing the window in Safari/Chrome?
In IE and FF, i can attach an event handler to onBeforeUnload, and by passing a string to a property of the event, the user will see a dialog asking him whether he wants to continue with the "unloading" (either closing the window or navigating…

Daniel Magliola
- 30,898
- 61
- 164
- 243
6
votes
1 answer
Rails 3 form helper to prevent user from navigating away and losing changes?
Is there a Rails helper or a Rails way of preventing the user from leaving the current page if they're typed something into the form on the current page?
I'm trying to prevent people from losing data if they click a header link if they have unsaved…

Amy
- 1,318
- 3
- 12
- 24
5
votes
1 answer
How to trigger onunload event when removing iframe ?
How can the iframe's unload event be triggered when removing it?
Using the code below, when removeChild(iframe) is called, the onunload event is not triggered.
remove iframe
I'm using this…

Cains
- 883
- 2
- 13
- 23
4
votes
2 answers
Show popup window when the browser close
I'm developing an eCommerce(PHP) web site and here's my requirement.
Once the customer leave the order page or close the browser,
I would like to offer another product with pop up or alert box.
If they choose 'Yes', it will redirect to another…

Den
- 369
- 1
- 4
- 12
4
votes
3 answers
Strategies for preserving form data ( on tab/browser close )
I have an issue with a task management application where occasionally users close their browsers/tabs and the information which they type goes away because they accidentally close a browser/tab, resulting in the loss of the text which they've…

meder omuraliev
- 183,342
- 71
- 393
- 434
4
votes
3 answers
What happens to Javascript when page navigates away?
What happens to Javascript when page navigates away?
A book I am reading is instructing to clear things on "unload" event.
But what's the point? doesn't everything get lost and released when pages moves away in browser?
Thanks,
Sean

born2net
- 24,129
- 22
- 65
- 104
4
votes
0 answers
onUnload firing after page load when refreshing page
I've found something very strange and I'm quite amazed, I wonder if someone has found it before or could imagine what's hapenning.
I have an ASP.NET MVC3 chess application. Now I'm developing a lobby for users to join and send match invites to…

Bardo
- 2,470
- 2
- 24
- 42
3
votes
1 answer
How to do ajax synchronous call from Chrome's window.onunload?
I'm trying to do a jquery .ajax synchronous call on window.onunload. FF and IE works but not on Chrome. I had done some testing and Chrome seems to terminate the window and not wait for the response.
Here is my code:
window.onunload = function() {
…

deepsweech
- 31
- 4