HighDots Forums  

passing information between webpages using cookie

Javascript JavaScript language (comp.lang.javascript)


Discuss passing information between webpages using cookie in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Song Zhang
 
Posts: n/a

Default passing information between webpages using cookie - 09-27-2003 , 02:07 PM






I have two webpage, one is http://appA.mycompany.com/first.html and the
other is http://appB.mycompany.com/second.html

When a user visits first.html, he may click a button A, which launches
second.html. In second.html, there is a button, if clicked, a cookie is set
with “mycookie=ok;domain=.mycompany.com”.

At first.html, I have a function that keeps checking cookie with name
mycookie. If mycookie is set, an alert window is started to show the value
of mycookie.

My question is principally, is this doable? Thx in advance.

__________________________________________________ _______________
Instant message with integrated webcam using MSN Messenger 6.0. Try it now
FREE! http://msnmessenger-download.com


Reply With Quote
  #2  
Old   
Lasse Reichstein Nielsen
 
Posts: n/a

Default Re: passing information between webpages using cookie - 09-27-2003 , 02:34 PM






"Song Zhang" <sozst1 (AT) hotmail (DOT) com> writes:

Quote:
I have two webpage, one is http://appA.mycompany.com/first.html and
the other is http://appB.mycompany.com/second.html
....
In second.html, there is a button, if clicked, a cookie is set with
“mycookie=ok;domain=.mycompany.com”.

At first.html, I have a function that keeps checking cookie with name
mycookie.
....
My question is principally, is this doable? Thx in advance.
Technically, yes. However, it only works if the user's browser allows
cross-domain cookies, and not all browsers (or users) do that.

It is, however, probably your only chance of communicating between
pages in different domains.

/L
--
Lasse Reichstein Nielsen - lrn (AT) hotpop (DOT) com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'


Reply With Quote
  #3  
Old   
MikeB
 
Posts: n/a

Default Re: passing information between webpages using cookie - 09-27-2003 , 03:08 PM



How about if you use a HTA as your host and open each page in its own frame? I haven't done exactly
what the OP is asking, but similar to what I am describing. When you open each page, set a handle
to the window and just use a variable and I suppose a timer in the HTA to keep checking for a change
in the value of the variable.


"Lasse Reichstein Nielsen" <lrn (AT) hotpop (DOT) com> wrote

Quote:
"Song Zhang" <sozst1 (AT) hotmail (DOT) com> writes:

I have two webpage, one is http://appA.mycompany.com/first.html and
the other is http://appB.mycompany.com/second.html
...
In second.html, there is a button, if clicked, a cookie is set with
"mycookie=ok;domain=.mycompany.com".

At first.html, I have a function that keeps checking cookie with name
mycookie.
...
My question is principally, is this doable? Thx in advance.

Technically, yes. However, it only works if the user's browser allows
cross-domain cookies, and not all browsers (or users) do that.

It is, however, probably your only chance of communicating between
pages in different domains.

/L
--
Lasse Reichstein Nielsen - lrn (AT) hotpop (DOT) com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html
'Faith without judgement merely degrades the spirit divine.'



Reply With Quote
  #4  
Old   
Bryan Field-Elliot
 
Posts: n/a

Default Re: passing information between webpages using cookie - 09-27-2003 , 04:45 PM



This is not really a cross-domain cookie, it's a domain-wide cookie.
Most browsers allow this by default. What Song is proposing will work,
if he can write the Javascript timer code appropriately in first.html
(e.g. go to sleep for 1 second, try reading the cookie, etc.).


--

Bryan Field-Elliot
http://netmeme.org




Lasse Reichstein Nielsen wrote:
Quote:
"Song Zhang" <sozst1 (AT) hotmail (DOT) com> writes:


I have two webpage, one is http://appA.mycompany.com/first.html and
the other is http://appB.mycompany.com/second.html

...

In second.html, there is a button, if clicked, a cookie is set with
“mycookie=ok;domain=.mycompany.com”.


At first.html, I have a function that keeps checking cookie with name
mycookie.

...

My question is principally, is this doable? Thx in advance.


Technically, yes. However, it only works if the user's browser allows
cross-domain cookies, and not all browsers (or users) do that.

It is, however, probably your only chance of communicating between
pages in different domains.

/L


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.