Change the domain, keep the path..with javascript?

D

Danny

Hello:

I'm currently at http://www.domain.com/the-path.jsp, and I would like
to be able, with JavaScript--and possibly the click of a button, which
I will most likely attach to IE's toolbar--transport to
http://domain.dev.domain.com/the-path.jsp.

Here's the environment: My browser is set to the page http://www.domain.com/the-path.jsp
and I plan to add a button to IE's toolbar via the registry that I
would like to execute the JavaScript, which contain the code to
perform the aforementioned procedure.

My JavaScript knowledge is, as I'm sure you've already surmised,
limited.

Here's what I know (or what I think I know)

The .js file header:
oShell= new
ActiveXObject("WScript.Shell");

the object: window.location.replace [or href].

I have a feeling a "and if" statement is needed here. Am I correct?

BTW: As far as the registry button addition is concerned, I'm set on
how to do that.

Thank you in advance for your time and attention.
 
A

atxryan

Hello:

I'm currently athttp://www.domain.com/the-path.jsp, and I would like
to be able, with JavaScript--and possibly the click of a button, which
I will most likely attach to IE's toolbar--transport tohttp://domain.dev.domain.com/the-path.jsp.

Here's the environment: My browser is set to the pagehttp://www.domain.com/the-path.jsp
and I plan to add a button to IE's toolbar via the registry that I
would like to execute the JavaScript, which contain the code to
perform the aforementioned procedure.

My JavaScript knowledge is, as I'm sure you've already surmised,
limited.

Here's what I know (or what I think I know)

The .js file header:
oShell= new
ActiveXObject("WScript.Shell");

the object: window.location.replace [or href].

I have a feeling a "and if" statement is needed here. Am I correct?

BTW: As far as the registry button addition is concerned, I'm set on
how to do that.

Thank you in advance for your time and attention.

Here's something quick:

var url = window.location;
url = url.toString();
url = url.replace(/www.domain.com/,"domain.dev.domain.com")
window.location = url;

-RYAN
 
D

Danny

I'm currently athttp://www.domain.com/the-path.jsp, and I would like
to be able, with JavaScript--and possibly the click of a button, which
I will most likely attach to IE's toolbar--transport tohttp://domain.dev.domain.com/the-path.jsp.
Here's the environment: My browser is set to the pagehttp://www.domain.com/the-path.jsp
and I plan to add a button to IE's toolbar via the registry that I
would like to execute the JavaScript, which contain the code to
perform the aforementioned procedure.
My JavaScript knowledge is, as I'm sure you've already surmised,
limited.
Here's what I know (or what I think I know)
The .js file header:
oShell= new
ActiveXObject("WScript.Shell");
the object: window.location.replace [or href].
I have a feeling a "and if" statement is needed here. Am I correct?
BTW: As far as the registry button addition is concerned, I'm set on
how to do that.
Thank you in advance for your time and attention.

Here's something quick:

var url = window.location;
url = url.toString();
url = url.replace(/www.domain.com/,"domain.dev.domain.com")
window.location = url;

-RYAN- Hide quoted text -

- Show quoted text -

Thanks for that code. Would you give me a brief explanation of how I
would execute that from outside the page being viewed. That is, I
would like to execute it by double-clicking a JS or HTML file, if it's
possible.

Thanks for your continued time and attention.
 

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

No members online now.

Forum statistics

Threads
474,160
Messages
2,570,889
Members
47,420
Latest member
ZitaVos505

Latest Threads

Top