I have parent page and child page. In child page body tag i have below code.
Maybe try onbeforeunload
event?
Modern WebKit browsers don't necessarily fire the unload
event at the moment where the page is hidden. This is done in order to allow improved caching.
You might consider replacing the use of unload
with the pagehide
event.
See this blog post for an in-depth discussion.
Unload works in modern browsers, but for example you cant launch an alert. See: http://bugs.jquery.com/ticket/10509
Also if you want to use $.get or $.post in unload, is better that you use $.ajax with async=false.
Ex:
$(window).unload(function() {
$.ajax({
url: '/some_url.htm',
async: false
});
});
yea onbeforeunload attached to window (or inner window of the child page) should do it