Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > URL Capture question resolved...need a tweak

Reply
Thread Tools

URL Capture question resolved...need a tweak

 
 
DGS
Guest
Posts: n/a
 
      05-17-2007
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.


 
Reply With Quote
 
 
 
 
DGS
Guest
Posts: n/a
 
      05-17-2007

"Randy Webb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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...


 
Reply With Quote
 
 
 
 
DGS
Guest
Posts: n/a
 
      05-17-2007

"Randy Webb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> DGS said the following on 5/17/2007 2:08 PM:
>> "Randy Webb" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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!


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Treeview tweak richie_hackett@hotmail.com ASP .Net 0 11-09-2005 09:26 PM
Windows Desktop Heap Tweak Guide Posted! Silverstrand Front Page News 0 07-20-2005 10:46 PM
TWEAK UI question JJ Computer Information 2 12-21-2004 03:12 PM
Here's a mozilla, Firefix speed tweak 4 u all Bryan Hamilton Firefox 27 09-29-2004 07:19 PM
Tweak UI question ok Computer Information 0 04-10-2004 04:13 PM



Advertisments