URL Capture question resolved...need a tweak

D

DGS

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.
 
D

DGS

Randy Webb said:
DGS said the following on 5/17/2007 12:50 PM:

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...
 
D

DGS

Randy Webb said:
DGS said the following on 5/17/2007 2:08 PM:

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!
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top