473,246 Members | 1,257 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,246 software developers and data experts.

Invisible cookies with Javascript for IE 6

Hello everybody!
I had no experience with cookies up to today.
I read about the properties of cookies. Then I started to write
a few lines of Javascript into my html-page:

function SetMyValue(name, val)
{
document.cookie = name+"="+val;
}

and

SetMyValue('firstname','michael');

I did not set the properties "expires" and "domain".

When I put the page to my server, called it with the IE 6 and looked
into the IE for my cookie, it was not there. But when I made a cgi program
that showed HTTP_COOKIE, I saw, that the IE was sending it. So I had
an invisible cookie with my IE. Only when closed the IE and opened it again,
it was lost.
Strange thing!
Wolfgang Adamec

---
http://www.wiesenblume.at
Jul 23 '05 #1
4 1856
In article <c4**************************@posting.google.com >,
w.******@gmx.at (Wolfgang Adamec) wrote:
Hello everybody!
I had no experience with cookies up to today.
I read about the properties of cookies. Then I started to write
a few lines of Javascript into my html-page:

function SetMyValue(name, val)
{
document.cookie = name+"="+val;
}


I suggest using an existing set of cookie routines. The document.cookie
can contain existing cookies and you need to preserve them. ( Don't know
why such routines aren't shipped with the browsers. )
~kaeli~ has developed some cookie code. You may view it in this article:

http://groups.google.com/groups?hl=e...859-1&selm=MPG
..1af96c2a4f8abc94989dcc%40nntp.lucent.com

Also, ~kaeli~ reports that:
There's some even better code that sets more cookie properties like
domain, secure, path, etc here.
http://www.acm.uiuc.edu/webmonkeys/j...ipt/cookies.js

Robert
Jul 23 '05 #2
Robert <rc*******@my-deja.com> writes:
document.cookie = name+"="+val;
I suggest using an existing set of cookie routines. The document.cookie
can contain existing cookies and you need to preserve them.


This code will preserve existing cookies. The cookie property is "magical"
in the sense that it doesn't act like a normal object property. Assigning
such a string, preferably with host/path/expiration information as well,
will only add one cookie to the set that exists. Reading it back will
generate a string containing all cookies, with no expiration information.

Try this code:
---
document.cookie = "hello=world";
document.cookie = "world=now";
alert(document.cookie);
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #3
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<ad**********@hotpop.com>...
Robert <rc*******@my-deja.com> writes:
document.cookie = name+"="+val;

I suggest using an existing set of cookie routines. The document.cookie
can contain existing cookies and you need to preserve them.


This code will preserve existing cookies.


How true. Indeed the cookie code I use uses a regular assignment.

Robert
Jul 23 '05 #4
..

When I put the page to my server, called it with the IE 6 and looked
into the IE for my cookie, it was not there. But when I made a cgi program
that showed HTTP_COOKIE, I saw, that the IE was sending it. So I had
an invisible cookie with my IE. Only when closed the IE and opened it again,
it was lost.


How do you want the cookie to work?

Without giving the date, the cookie expires when the session goes
away.

I have had a bit of trouble with cookies with IE when I didn't specify
the date. The cookie would disappear on me. I found it necessary to
provide a date

Robert
Jul 23 '05 #5

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

Similar topics

4
by: changed | last post by:
I have an application that works almost all of the time but there is an inconsistent error with some browsers (some Mac, some PC). It seems that the cookie won't get written before the redirect. ...
1
by: Aaron | last post by:
Data I'm saving to a Cookie looks like this: "A,B,C^1,2,3" I need everything to the left of the "^" to go in one input box, and everything to the right in another input box when I load the...
3
by: FantaJ | last post by:
Hi, Is it possible to make a html button invisible using javascript? I can certainly disable it: var x=document.getElementById('button2'); x.disabled=true; //x.type = 'hidden'; // read...
2
by: john | last post by:
I have some controls that I want to be invisible, but if the user does something, they will become visible using javascript. So I can't set its "visible" property to false, because then they won't...
0
by: Elmo Watson | last post by:
Scenario: One tab has main Customer information (name, address, etc) another tab has Billing info (same types of data, different field names in order to make the billing info panel/tab visible,...
0
by: Susan Van Houen | last post by:
Hi Everybody, I have a problem that is driving me crazy and I am hoping for some help here. I am building an application (vb.net, vs2003) that crawls selected websites. The application works...
0
by: dotnettester | last post by:
Hi, I want to detect if the clients browser has cookies/javascript disabled. I know the class 'HttpBrowserCapabilities' but it gives information about the capabilities of client browser not the...
6
by: Charlie | last post by:
Hi: I have sections on a page in asp panels. I would like to hide/show using javascript, but don't see a visible property for DIV. How do you do this? Thanks, Charlie
2
by: David Thielen | last post by:
Hi; 1) What is the easiest way to show in an aspx page if they have scripts enabled? 2) What is the easiest way to show in an aspx page if they have cookies enabled? This is for a test...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.