onunload

Which event handler to use to record leaving page - onunload or onbeforeunload?

Hi all, Having not any answers to my previous questions about using javascript to measure page turn times, I'm going to start writing my own code (!). To measure the length of tie it takes, I'm proposing dropping a cookie containing a timestamp when the user browses away from a page, then in a subsequent page, comparing that time with ...

Is it posible to use "confirmit" to open new url in the same window?

I'm using a the confirmit java script function to redirect to a new url with a positive response. It doesn't do exactly what I want - and maybe I can't have exactly what I want. Here's what it does - onunload, with a positive response it opens the new url in a new window, which can be blocked by a pop-up blocker without the user even k...

onunload message needed but not when they click internal links

okay i have a question... i need an message script that only will come up when people are really leaving the current webpage so not the current website... so actualli when people are leaving the website entirelly the message will come up, they need to press the ok button to stay at the current page and cancel to leave the entire websit...

Cross browser window close event

Possible Duplicate: Close /Kills the seesion when close the browser or tab Is there a solution for cross browser event. I need to check if user closes their window and to throw an ajax request to my database to sign them out. I've looked everyone but most cases its not working in all browsers. Anyone have a solution? Or Alte...

Get url for the page being opened next in window.onunload event

Hi, Is there a way get the location for page being opened next in the window.onunload event. Best Regards, Keshav ...

Save state using HTML5 Web SQL on window unload

I'm using the Web SQL API to store some information on a page; I'd like to save the state of the page when the user closes the page or navigates away, thus, I start with: window.onunload = function () { db.transaction(function (tx) { executeSql("INSERT INTO State (foo) VALUES (?)", [foo]); }); }; However, this is asynchronous ...

Attatching setTimeout() to window.opener from window in unload callback

Hi, I'm trying to do this: $(function() { var parent = window.opener; $(window).bind('unload', function() { parent.setTimeout(function() { parent.console.log('Fired!'); }, 200); } }); The example above works well in FF, Chrome etc. but not IE8. In the latter, the callback specified in setTimeo...

How to know when popup is closed in javascript

This code will open go.com in popup window: <a href="javascript:void(0)" onClick="javascript:window.open('http://go.com','','status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no ,width=300px,height=300px')">open</a> and I want to use alert('closed!') in main page, when popup is closed and I can't edit popup page for use onunlo...

IFrame on unload refresh parent page

I have an iframe in a page. When the iframe is closed I would like to refresh the parent page. Checking out the iframe element w3 page I see there are no standard events. I considered a polling approach, having the parent page constantly check if the frame is created, and then checking if it is removed and then refreshing, however this ...

Opening an iframe source in a new tab if it tries to redirect the user

It's a known fact that a lot of websites use javascript codes to prevent from browsing them using iframes. I would like then my iframe to behave like this: if the site doesn't have such a code and isn't trying to redirect the user, its content should be shown in the iframe. But if it's trying to redirect, it should be opened in a new tab...

Confirm Browser Exit/ On Browser Exit Techniques

I've been looking around for a while and haven't quite found what I've been looking for. My web page stores reports, and the user has the ability to save these reports. I'm looking for a method, using jquery or the javascript onunload/onbeforeunload to ask the user if they wish to save the report or continue without saving when the brow...

Javascript submit() event is not fired up on exit (unload event)

I got page where HTML elements <form> and <iframe> are dinamicaly created with Javascript: document.write('<iframe id="myIframe" name="myIframe" src="about:blank" style="display:none;"></iframe>'); document.write('<form id="myForm" name="myForm" method="post" target="myIframe" action="myURL.php" style="display:none;">'); document.write(...