Cookie Not Available after window.open

Discussion in 'Javascript' started by Scott, Jul 9, 2004.

  1. Scott

    Scott Guest

    Here is the scenario. I need to launch a popup using window.open, but
    can't pass everything i need to pass on the querystring. So I thought
    I would set a cookie.

    Basically I do:

    setCookie('NameList', aReallyLongListOfNames);
    window.open(aWindowThatNeedsToReadNameList);

    then in the window (on the server side) I try to access the cookie,
    but it is not there. What gives? I know that document.cookie has the
    NameList before the window.open call.
     
    Scott, Jul 9, 2004
    #1
    1. Advertising

  2. Scott

    Jeff North Guest

    On 9 Jul 2004 15:20:00 -0700, in comp.lang.javascript
    (Scott) wrote:

    >| Here is the scenario. I need to launch a popup using window.open, but
    >| can't pass everything i need to pass on the querystring. So I thought
    >| I would set a cookie.
    >|
    >| Basically I do:
    >|
    >| setCookie('NameList', aReallyLongListOfNames);
    >| window.open(aWindowThatNeedsToReadNameList);
    >|
    >| then in the window (on the server side) I try to access the cookie,
    >| but it is not there. What gives? I know that document.cookie has the
    >| NameList before the window.open call.


    You could try using POST to send all of your data to the pop-up
    window.
    <form name="f1" method="post" .....>

    popup would need
    <%
    v1 = Request.Form("value1")
    etc etc etc
    %>
    Both the GET and POST methods have length limitations (200+ characters
    and 4k respectively). Cookies also have a size limit (4k). If your
    data is still exceeding this limit then you will have to rethink what
    data you are transmitting between pages.
     
    Jeff North, Jul 10, 2004
    #2
    1. Advertising

  3. Scott

    Scott Guest

    Because of the way the popup windows communicates its data back to the
    parent, i need to use window.open. How would I do that with a post? I
    kicked around the idea of doing a post but I couldn't figure out how
    to make it work with window.open.

    TIA
    Scott Monte

    Jeff North <> wrote in message news:<>...
    > On 9 Jul 2004 15:20:00 -0700, in comp.lang.javascript
    > (Scott) wrote:
    >
    > >| Here is the scenario. I need to launch a popup using window.open, but
    > >| can't pass everything i need to pass on the querystring. So I thought
    > >| I would set a cookie.
    > >|
    > >| Basically I do:
    > >|
    > >| setCookie('NameList', aReallyLongListOfNames);
    > >| window.open(aWindowThatNeedsToReadNameList);
    > >|
    > >| then in the window (on the server side) I try to access the cookie,
    > >| but it is not there. What gives? I know that document.cookie has the
    > >| NameList before the window.open call.

    >
    > You could try using POST to send all of your data to the pop-up
    > window.
    > <form name="f1" method="post" .....>
    >
    > popup would need
    > <%
    > v1 = Request.Form("value1")
    > etc etc etc
    > %>
    > Both the GET and POST methods have length limitations (200+ characters
    > and 4k respectively). Cookies also have a size limit (4k). If your
    > data is still exceeding this limit then you will have to rethink what
    > data you are transmitting between pages.
     
    Scott, Jul 10, 2004
    #3
  4. Scott

    Jeff North Guest

    On 10 Jul 2004 07:04:06 -0700, in comp.lang.javascript
    (Scott) wrote:

    >| Because of the way the popup windows communicates its data back to the
    >| parent, i need to use window.open. How would I do that with a post? I
    >| kicked around the idea of doing a post but I couldn't figure out how
    >| to make it work with window.open.


    page1.asp
    ---------
    <html>
    <head>
    <title>Page 1</title>
    </head>
    <body>
    <FORM action="page2.asp" METHOD="post" name="f1" target="_blank"
    id="f1" >
    <table width="100%" border="0" cellspacing="0" cellpadding="5">
    <tr><td><input name="text1" type="text" value="text1" /></td></tr>
    <tr><td><input name="text4" type="text" id="text4" value="text4"
    /></td></tr>
    <tr><td><input type="submit" name="Submit" value="Submit"
    /></td></tr>
    </table>
    </FORM>
    </body>
    </html>

    page2.asp
    ---------
    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    <%
    Response.Write("+++" + Request.Form + "+++" );
    %>
    <html>
    <head>
    <title>Page 2</title>
    </head>
    <body>
    </body>
    </html>


    >| TIA
    >| Scott Monte
    >|
    >| Jeff North <> wrote in message news:<>...
    >| > On 9 Jul 2004 15:20:00 -0700, in comp.lang.javascript
    >| > (Scott) wrote:
    >| >
    >| > >| Here is the scenario. I need to launch a popup using window.open, but
    >| > >| can't pass everything i need to pass on the querystring. So I thought
    >| > >| I would set a cookie.
    >| > >|
    >| > >| Basically I do:
    >| > >|
    >| > >| setCookie('NameList', aReallyLongListOfNames);
    >| > >| window.open(aWindowThatNeedsToReadNameList);
    >| > >|
    >| > >| then in the window (on the server side) I try to access the cookie,
    >| > >| but it is not there. What gives? I know that document.cookie has the
    >| > >| NameList before the window.open call.
    >| >
    >| > You could try using POST to send all of your data to the pop-up
    >| > window.
    >| > <form name="f1" method="post" .....>
    >| >
    >| > popup would need
    >| > <%
    >| > v1 = Request.Form("value1")
    >| > etc etc etc
    >| > %>
    >| > Both the GET and POST methods have length limitations (200+ characters
    >| > and 4k respectively). Cookies also have a size limit (4k). If your
    >| > data is still exceeding this limit then you will have to rethink what
    >| > data you are transmitting between pages.
     
    Jeff North, Jul 10, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PC HUA
    Replies:
    2
    Views:
    416
    PC HUA
    May 19, 2004
  2. yawnmoth
    Replies:
    1
    Views:
    98
    Randy Webb
    Aug 29, 2004
  3. TM360
    Replies:
    2
    Views:
    196
    TM360
    Jun 30, 2005
  4. Replies:
    2
    Views:
    403
  5. Jimmy
    Replies:
    1
    Views:
    325
    Thomas 'PointedEars' Lahn
    Oct 6, 2007
Loading...

Share This Page