473,320 Members | 1,953 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,320 software developers and data experts.

Capturing partial URL and using that as part of a link

Hi...

I need help in finding a way to capture a partial URL link and then
store that as a variable so that I can use it as part of a hyperlink.
I was hoping Javascripting would allow me to do this since I don't have
PHP engine in our server.

The reason for this is that we have a test environment and a
production. There is a timeout webpage that the user sees when their
session times out after 30 minutes of inactivity. However, every time
we run it thru test, we have to also create another version for
production as the links are different between test and prod. So it
would be nice if we have a way to dynamically generate the hyperlink in
the timeout page based on what URL the user came from.

ie. the URL is http://www.mysite.com/testsite/stage/new/

I want my timeout webpage to be able to identify partial such as
/testsite/ from the URL on the address bar and store that into a
variable and then I need to know how I would be able to create a
dynamic hyperlink for it instead of having to hardcode:
<p><a href="http://www.mysite.com/testsite/login">click to
login</a></p>

Not sure if that makes sense or not... ;P

Mar 20 '06 #1
2 2128
dexterbot wrote:
ie. the URL is http://www.mysite.com/testsite/stage/new/

I want my timeout webpage to be able to identify partial such as
/testsite/ from the URL on the address bar and store that into a
variable and then I need to know how I would be able to create a
dynamic hyperlink for it instead of having to hardcode:
<p><a href="http://www.mysite.com/testsite/login">click to
login</a></p>
var s = window.location.href.replace(
/^(https?:\/\/([^\/]+\/){2})stage\/new\//,
"$1login");
Not sure if that makes sense or not... ;P


Probably you are better off using server-side redirection instead.
PointedEars
Mar 20 '06 #2
That's the problem, I can't use a server-side redirection. I can't
even setup a PHP engine to do PHP otherwise I can probably do PHP to
redirect. It's just a limitation of what we can do here.

Nonetheless, thanks for taking the time to reply.

Mar 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matt Bostock | last post by:
Hi, Please see: http://www.drfunkenstein.net/catalogue/categories/fancydress/81/go/2/ ...and try clicking on the '< previous' link underneath the costume thumbnails. The link is only...
6
by: nospam | last post by:
I just read on Slash Dot about partial types. Now, is it possible to have a code behind split over two pages but still referencing the same .aspx file??? If so, that would be really nice as...
15
by: Tony Gahlinger | last post by:
I'm using my browser (Mozilla/5.0 Linux i686 Gecko/20031007 Firebird/0.7) to do some client-side image processing. I want to capture the sequence of coordinates a user clicks on in xxx.jpg in the...
3
by: sparks | last post by:
They have a new data collection station. The people here are using access 97.... This third party site will only post data back to us when we do this. ...
16
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought Iā€™d be able to create another class file, call it a partial class and have that compile and...
2
by: Stampede | last post by:
Hi guys & girls, I would like to write some kind of "Head-Tracking-Software", which uses a WebCam to react to the movement of the head of the person sitting in front of the monitor. I searched...
1
by: Bishoy George | last post by:
In a web application using asp.net 2.0 All my classes are partial classes. - I noticed that partial class cannot be inherited... is that true? - I tried to remove the partial keyword , and I...
9
by: blackdog | last post by:
I compiled *.cs which contains public partial class xxx: System.Web.UI.Page I got errors as below: xxx_cs.aspx.cs: error CS1518: Expected class, delegate, enum, interface, or struck. Please...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.