...

View Full Version : how to capture refresh of page



rohitchawla
08-31-2007, 06:00 AM
i am using session cookies to store some values
but i want the cookie to clear the data when the user refreshes the page
how can i capture the refresh using javascript and call my function that clears the cookie

Philip M
08-31-2007, 07:40 AM
<body onload = "clearCookie()" >

function clearCookie() {
.... clear the cookie
}

rohitchawla
08-31-2007, 07:51 AM
i cannot use onload event as the value of cookie will be reset after the page has fully loaded after refresh
and i need the value of cookie to reset after the user clicks refresh as im changing the value of cookie as the page is loading
and the value of cookie is not null when page is loading
it sets to null only after page has loaded in onload

i used another event onbeforeunload and it worked for me

but onbeforeunload is not resetting the cookie in opera
it is working fine in IE, firefox and netscape

is there a way to implement in opera

thanks in advance

Philip M
08-31-2007, 10:39 AM
The onbeforeunload event is a Microsoft proprietary invention, and neither Opera nor Safari implements it. Although Opera probably supports more of Microsoft's proprietary features than any other browser.

BTW, the time to say "thanks" is afterwards, not before when "please" is usually considered polite. If you are find this response helpful then please use the "Thank You For This Post" button.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum