473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

URL Capture question resolved...need a tweak

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
4 2457
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Me Mine | last post by:
i, I have trying to code a small console app that will allow a user to select a window and then create a screen capture of the window. I haven't been able to figure out how to do the screen...
2
by: Kim Petersen | last post by:
Memory leak - malloc/free implementation - GC kicking in late - know bug - or ? Using python-2.2.2-26 on RH9 (shrike) x86 -fully patched The following program slowly eats up more and more...
4
by: Beeman | last post by:
I am looking for a good control that would display/print JPEG images in Access 97. The existing Image controls, even with the JPEG filters, are very slow - and I know there are better ones out...
3
by: Juan Crespo | last post by:
Dear Sirs: My name is Juan Crespo and I write you from Spain, I work as application developer in Industrial Automation in Spain. We have as customer a company that wants to reuse old computers...
2
by: Jose | last post by:
There's something for me to learn with this example, i'm sure :) Given this text: "....." and my first attempt at capture the groups: "(?:\)" RegExTest gives me what i expect: 6 captured...
5
by: ewillyb | last post by:
Hi, ASP.NET has some interesting behavior when the user hits the Enter key. If there are multiple ASP:Buttons (rendered as HTML submits) on the form, when the user hits enter, the first button's...
3
by: JeffDotNet | last post by:
I wrote a small data processing application that writes a summary of several hundred files. I use drag and drop on a panel (Panel1) to grab the absolute path to each of these files. Then I begin...
3
by: amanjsingh | last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke...
7
by: Lew | last post by:
Hi, I'm looking for a tool that can capture all the sql transactions for a period of time (24 hours or so ) from our production server and replay it exactly as entered on our performance tuning...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.