By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,853 Members | 842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,853 IT Pros & Developers. It's quick & easy.

URL Capture question resolved...need a tweak

P: n/a
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.
May 17 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 17 '07 #2

P: n/a
DGS

"Randy Webb" <Hi************@aol.comwrote in message
news:u6********************@giganews.com...
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...
May 17 '07 #3

P: n/a
DGS said the following on 5/17/2007 2:08 PM:
"Randy Webb" <Hi************@aol.comwrote in message
news:u6********************@giganews.com...
>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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 17 '07 #4

P: n/a
DGS

"Randy Webb" <Hi************@aol.comwrote in message
news:Mo********************@giganews.com...
DGS said the following on 5/17/2007 2:08 PM:
>"Randy Webb" <Hi************@aol.comwrote in message
news:u6********************@giganews.com...
>>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!
May 17 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.