stupid javascript

edited November 2006 in Internet & Media
arrggh.... ok i HATE web programming btw...


ok i have a problem. i want a cookie to be deleted when a popup window closes, NOT when the browser is shut down. Here's what I'm doing to try and make this happen.

in head:

[PHP]
<script type="text/javascript">
function Delete(){
document.cookie = 'phpfreechat=test; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';
}
</script>
[/PHP]

in the body:

[PHP]
<body onunload="Delete();return false;">
.
.
.
</body>
[/PHP]

but this doesn't work at all, it doesn't do anything....

any ideas?

Comments

  • RWBRWB Icrontian
    edited November 2006
    I wouldn't really know to be honest I never mess with cookies :P But maybe this helps.

    http://techpatterns.com/downloads/javascript_cookies.php

    [PHP]// this deletes the cookie when called
    function Delete_Cookie( name, path, domain ) {
    if ( Get_Cookie( name ) ) document.cookie = name + "=" +
    ( ( path ) ? ";path=" + path : "") +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }[/PHP]
Sign In or Register to comment.