Delete cookie
yasotha
Status: New User - Welcome
Joined: 23 May 2007
Posts: 3
Reply Quote
i open a webpage using javascript window.open method.
one cookie is created when i open that window. i know that cookie name.i want to delete that cookie[note- this cookie not in my system's cookie folder].how can i delete that cookie using javascript fucntion.[/b]
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Try this javascript cookies script.

That has set, get, and delete functions for javascript cookies.
Back to top
Delete Cookie
yasotha
Status: New User - Welcome
Joined: 23 May 2007
Posts: 3
Reply Quote
it is already created cookie. just i want to delete that cookie.
for this shall i use this delete script function

function Delete_Cookie(name, path, domain )
{
alert(name);
alert(path);
alert(domain);
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

i cal this function by

onClick="Delete_Cookie('JSESSIONID','urll','http://www.uspto.gov');"

where 'JSESSIONID' - cookie name
urll- url of a web page

i dont want to set cookie.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Who said you had to set the cookie? I pointed you to a script that has functions for deleting, getting, and setting cookies. So use the stuff that you need, in this case the cookie deletion component.

But since those 3 functions are required for all cookie handling, it's a lot easier to just integrate them into your script and just call each one as required.
Back to top
plse correct my code
yasotha
Status: New User - Welcome
Joined: 23 May 2007
Posts: 3
Reply Quote
am using the following javascript to get a cookie of a web page.

function Delete_Cookie(name, path, domain )
{
chwin=window.open(path,'_blank');
alert(window.document.cookie);
}
it is working well. but if i give like this
alert(chwin.document.cookie);

it doesnot alert any thing.
how can i get chwin cookie.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours