passing information between webpages using cookie

Discussion in 'Javascript' started by Song Zhang, Sep 27, 2003.

  1. Song Zhang

    Song Zhang Guest

    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
     
    Song Zhang, Sep 27, 2003
    #1
    1. Advertisements

  2. 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, Sep 27, 2003
    #2
    1. Advertisements

  3. Song Zhang

    MikeB Guest

    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.
     
    MikeB, Sep 27, 2003
    #3
  4. 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, Sep 27, 2003
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.