how to destroy cookies when the browser is closed? i have a php script where initially the user logs in and then the subsequent pages are displayed.i want that if the user closes the browser in between n tries to re-open the same page, he gets the error message that he has to login first (i.e the cookies which i have set once the user is logged in shud be destroyed once the user closes the browser.I am able to destroy my cookie after log out,but don't know how to destroy this when I will close the browser.

10 Years
Discussion Span
Last Post by scottholmes

can you help me with the code in javascript? i am very new to javascript


i figured out a javascript to use with php, but here agn i am not sure where to place the code for erasing the cookies. also in my page there are links to other pages, so everytime i click on any link, the message pops up. how cn i avoid that?

<script language="JavaScript">
var needToConfirm = true;
window.onbeforeunload = confirmExit;
function confirmExit()
        if (needToConfirm)
                return "Are you sure you want to exit?";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.