473,394 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Killing all cookies

I have an application that sets a variable number of randomly-named cookies.
I'm currently using the following script to kill all of them. I'm using the
script because I couldn't find a simpler way. Did I miss something, or is
there a simpler method available?

cookies = document.cookie.split(";");
for (i=0;i<cookies.length;i++) {
indCookie = cookies[i].indexOf("=");
cName=cookies[i].substring(0,indCookie);
setCookie(cName,'',-1); //function to set cookies
}
--
Ed Jay (remove 'M' to respond by email)
Feb 28 '07 #1
2 1812
On Feb 27, 8:22 pm, Ed Jay <e...@aes-intl.comwrote:
I have an application that sets a variable number of randomly-named cookies.
I'm currently using the following script to kill all of them. I'm using the
script because I couldn't find a simpler way. Did I miss something, or is
there a simpler method available?

cookies = document.cookie.split(";");
for (i=0;i<cookies.length;i++) {
indCookie = cookies[i].indexOf("=");
cName=cookies[i].substring(0,indCookie);
setCookie(cName,'',-1); //function to set cookies
}
Well, you could just set document.cookie to an empty string.
--
Ed Jay (remove 'M' to respond by email)

Feb 28 '07 #2
Benjamin scribed:
>On Feb 27, 8:22 pm, Ed Jay <e...@aes-intl.comwrote:
>I have an application that sets a variable number of randomly-named cookies.
I'm currently using the following script to kill all of them. I'm using the
script because I couldn't find a simpler way. Did I miss something, or is
there a simpler method available?

cookies = document.cookie.split(";");
for (i=0;i<cookies.length;i++) {
indCookie = cookies[i].indexOf("=");
cName=cookies[i].substring(0,indCookie);
setCookie(cName,'',-1); //function to set cookies
}
Well, you could just set document.cookie to an empty string.
>>
As in document.cookie = ''; Nope.
--
Ed Jay (remove 'M' to respond by email)
Feb 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any...
20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
6
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item)...
6
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a...
1
by: krose | last post by:
Hi Using a couple of examples on CodeProject.com I've create a nice little shell extension (adds some custom menus for proprietary file types). Everything is working fine, except I can't get it...
2
by: news.microsoft.com | last post by:
I am having a difficult time with cookies. In my code, I need to allow a user to login to my admin site. I figure I can set a cookie, then authenticate them, and all should be well. This works,...
6
by: Stephane | last post by:
Hi, I have a login page where if the user wants his access codes to be saved are set into a cookie. In the logout page, I want to delete those cookies. I tried this and this is not working at...
0
by: ClevrMnkey | last post by:
I am having a devil of a time getting rid of cookies. Because of the silly 20 cookies/domain limit of IE I need to clear them out when vistors go from one area through a portal to the next. Here...
0
by: rn5a | last post by:
This is how I am creating & then reading cookies: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) 'create cookies Response.Cookies("UserName").Value = "Ron"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.