URL Capture question resolved...need a tweak

Discussion in 'Javascript' started by DGS, May 17, 2007.

  1. DGS

    DGS Guest

    Hi all...

    Yesterday I asked about setting a cookie with an intially requested URL that
    could be used later. I found the code to do it. For the code on the
    login.html page I would like to tweak it to NOT be server specific. Here is
    the code for the front end:

    <SCRIPT LANGUAGE=JavaScript>
    if(document.URL != "https://test2k301/pkmslogin.form"){
    document.cookie = ('Referrer_Page='+document.URL)+'; path=/';
    }
    </SCRIPT>

    Anybody know of a way I can make this work with JUST the path? Put in other
    words...I'd like for it to check this to look for ONLY "/pkmslogin.form".
    However, I still want the cookie to always contain the full URL. This would
    effectively make it so I didn't have to change the code to be server
    specific for each server this gets copied to.
     
    DGS, May 17, 2007
    #1
    1. Advertising

  2. DGS

    DGS Guest

    "Randy Webb" <> wrote in message
    news:...
    > DGS said the following on 5/17/2007 12:50 PM:
    >> Hi all...
    >>
    >> Yesterday I asked about setting a cookie with an intially requested URL
    >> that could be used later. I found the code to do it. For the code on
    >> the login.html page I would like to tweak it to NOT be server specific.
    >> Here is the code for the front end:
    >>
    >> <SCRIPT LANGUAGE=JavaScript>
    >> if(document.URL != "https://test2k301/pkmslogin.form"){
    >> document.cookie = ('Referrer_Page='+document.URL)+'; path=/';
    >> }
    >> </SCRIPT>
    >>
    >> Anybody know of a way I can make this work with JUST the path? Put in
    >> other words...I'd like for it to check this to look for ONLY
    >> "/pkmslogin.form". However, I still want the cookie to always contain the
    >> full URL. This would effectively make it so I didn't have to change the
    >> code to be server specific for each server this gets copied to.

    >
    > if (document.URL.indexOf('/pkmslogin.form') != -1)
    >


    Hmmm...somewhere along the lines this is breaking the functionality and
    causing the cookie to get set when /pkmslogin.form is the path...which is
    the why the if check is in place...
     
    DGS, May 17, 2007
    #2
    1. Advertising

  3. DGS

    DGS Guest

    "Randy Webb" <> wrote in message
    news:...
    > DGS said the following on 5/17/2007 2:08 PM:
    >> "Randy Webb" <> wrote in message
    >> news:...
    >>> DGS said the following on 5/17/2007 12:50 PM:
    >>>> Hi all...
    >>>>
    >>>> Yesterday I asked about setting a cookie with an intially requested URL
    >>>> that could be used later. I found the code to do it. For the code on
    >>>> the login.html page I would like to tweak it to NOT be server specific.
    >>>> Here is the code for the front end:
    >>>>
    >>>> <SCRIPT LANGUAGE=JavaScript>
    >>>> if(document.URL != "https://test2k301/pkmslogin.form"){
    >>>> document.cookie = ('Referrer_Page='+document.URL)+'; path=/';
    >>>> }
    >>>> </SCRIPT>
    >>>>
    >>>> Anybody know of a way I can make this work with JUST the path? Put in
    >>>> other words...I'd like for it to check this to look for ONLY
    >>>> "/pkmslogin.form". However, I still want the cookie to always contain
    >>>> the full URL. This would effectively make it so I didn't have to
    >>>> change the code to be server specific for each server this gets copied
    >>>> to.
    >>> if (document.URL.indexOf('/pkmslogin.form') != -1)
    >>>

    >>
    >> Hmmm...somewhere along the lines this is breaking the functionality and
    >> causing the cookie to get set when /pkmslogin.form is the path...which is
    >> the why the if check is in place...

    >
    > Change the != to ==
    >
    > if (document.URL.indexOf('/pkmslogin.form') == -1)
    >
    > If the indexOf is -1 then the string is not present.
    >


    That did the trick! Thanks very much Randy!
     
    DGS, May 17, 2007
    #3
    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. Treeview tweak

    , Nov 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    378
  2. Luke Airig
    Replies:
    0
    Views:
    613
    Luke Airig
    Dec 23, 2003
  3. =?Utf-8?B?Sm9u?=

    Performance tweak

    =?Utf-8?B?Sm9u?=, Oct 5, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    364
    Kevin Spencer
    Oct 5, 2006
  4. richie_hackett

    Treeview tweak

    richie_hackett, Nov 15, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    150
    richie_hackett
    Nov 21, 2005
  5. Bryan
    Replies:
    8
    Views:
    186
    Old Pedant
    Aug 20, 2008
Loading...

Share This Page