473,503 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

redirecting

Hi,
I am new to JavaScript and I have been sifting through the previous
posts about some specific help I need with a redirect problem. No luck
there! Could someone take a look and give me some suggestions. I could
really use some help.

What I am trying to accomplish is the following:
-grab the user bookmarked URL.
-strip some of the URL from the beginning
-pass what's leftover of the URL and append that to a new URL.
-i would then like to call this function in the body tag and pass it
to onLoad

<HEAD>
<script>
var domain=window.location.href;
var domain2 = domain.substr(0,29);
document.write("https://hfdev1.test.com/rw"+domain2")

function test() {
document.location.href="https://hfdev1.test.com/rw"+domain2"
}
</script>
</HEAD>
<body onload="test()">

Thanks,
Slash
Jul 20 '05 #1
6 1728
sa*****@gwu.edu (slash) writes:
What I am trying to accomplish is the following:
-grab the user bookmarked URL.
I think you mean the current URL. You don't have access to bookmarks
from Javascript.
-strip some of the URL from the beginning
-pass what's leftover of the URL and append that to a new URL. -i would then like to call this function in the body tag and pass it
to onLoad
"pass it to onLoad"? That makes no sense. The way to put code into
the body tag is the onload attribute, but you don't pass anything to it.
<HEAD>
<script>
<script type="text/javascript">
var domain=window.location.href;
var domain2 = domain.substr(0,29); document.write("https://hfdev1.test.com/rw"+domain2") ^ that " is wrong
function test() {
document.location.href="https://hfdev1.test.com/rw"+domain2" ^and this }


Otherwise it looks fine.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
"slash" <sa*****@gwu.edu> wrote in message
news:30**************************@posting.google.c om...
Hi,
I am new to JavaScript and I have been sifting through the previous
posts about some specific help I need with a redirect problem. No luck
there! Could someone take a look and give me some suggestions. I could
really use some help.

What I am trying to accomplish is the following:
-grab the user bookmarked URL.
-strip some of the URL from the beginning
-pass what's leftover of the URL and append that to a new URL.
-i would then like to call this function in the body tag and pass it
to onLoad

<HEAD>
<script>
var domain=window.location.href;
var domain2 = domain.substr(0,29);
document.write("https://hfdev1.test.com/rw"+domain2")

function test() {
document.location.href="https://hfdev1.test.com/rw"+domain2"
}
</script>
</HEAD>
<body onload="test()">

Thanks,
Slash

Looks like you're on the right track.

However, you should
a) remove the quotation mark after all references to "domain2"
b) remove the prefixes from all references to "location.href".
Could you provide a better example of what you're trying to do?
-grab the user bookmarked URL.
Is this the full URL that invoked the page?
-strip some of the URL from the beginning
What is "some of"? Is the the page's filename?
-pass what's leftover of the URL and append that to a new URL.


What's the format of the new URL?
Are you passing the "some of" as a querystring?
Give the following URL:
http://{domain}/{folder}/page.htm
what do you want stripped out for later use?

Jul 20 '05 #3
sa*****@gwu.edu (slash) wrote in
news:30**************************@posting.google.c om:
What I am trying to accomplish is the following:
-grab the user bookmarked URL.
-strip some of the URL from the beginning
-pass what's leftover of the URL and append that to a new URL. ^^^^^^^^ -i would then like to call this function in the body tag and pass it
to onLoad

<HEAD>
<script>
var domain=window.location.href;
var domain2 = domain.substr(0,29);
That gets the first 29 characters of the URL, not the leftovers.
document.write("https://hfdev1.test.com/rw"+domain2")

function test() {
document.location.href="https://hfdev1.test.com/rw"+domain2"
}
</script>
</HEAD>
<body onload="test()">

Jul 20 '05 #4
Thank you for replying.
Here are the changes I made after your suggestions. I hope this is
what you were talking about.

<script>
var domain=location.href;
var junk = domain.substr(29);
document.write("https://hfdev1.fhlmc.com/rw"+domain)

function test() {
location.href="https://hfdev1.fhlmc.com/rw"+domain
}
</script>

we are migrating our webapp to a new junction. our endusers access
html files via urls similar
to the following url:
https://www.fhlmc.com/swebapps/sell/...svcr/test.html

our new url path for this same file is at:
https://www.fhlmc.com/rw/docs/mf_svcr/test.html

in case you are wondering, the files were copied over to the new
junction.

what i would like to do is to grab the following
part from the old url:

"/docs/mf_svcr/test.html"

and append it to the new url:

"https://www.fhlmc.com/rw" + "/docs/mf_svcr/test.html"

once I have that done, I would like to redirect
the user to that page. So, all of this happens
behind the scenes.

Would this be possible?

Thanks,
Slash
"McKirahan" <Ne**@McKirahan.com> wrote in message news:<ktLDb.130599$_M.672066@attbi_s54>...
"slash" <sa*****@gwu.edu> wrote in message
news:30**************************@posting.google.c om...
Hi,
I am new to JavaScript and I have been sifting through the previous
posts about some specific help I need with a redirect problem. No luck
there! Could someone take a look and give me some suggestions. I could
really use some help.

What I am trying to accomplish is the following:
-grab the user bookmarked URL.
-strip some of the URL from the beginning
-pass what's leftover of the URL and append that to a new URL.
-i would then like to call this function in the body tag and pass it
to onLoad

<HEAD>
<script>
var domain=window.location.href;
var domain2 = domain.substr(0,29);
document.write("https://hfdev1.test.com/rw"+domain2")

function test() {
document.location.href="https://hfdev1.test.com/rw"+domain2"
}
</script>
</HEAD>
<body onload="test()">

Thanks,
Slash

Looks like you're on the right track.

However, you should
a) remove the quotation mark after all references to "domain2"
b) remove the prefixes from all references to "location.href".
Could you provide a better example of what you're trying to do?
-grab the user bookmarked URL.


Is this the full URL that invoked the page?
-strip some of the URL from the beginning


What is "some of"? Is the the page's filename?
-pass what's leftover of the URL and append that to a new URL.


What's the format of the new URL?
Are you passing the "some of" as a querystring?
Give the following URL:
http://{domain}/{folder}/page.htm
what do you want stripped out for later use?

Jul 20 '05 #5
"slash" <sa*****@gwu.edu> wrote in message
news:30*************************@posting.google.co m...
Thank you for replying.
Here are the changes I made after your suggestions. I hope this is
what you were talking about.

<script>
var domain=location.href;
var junk = domain.substr(29);
document.write("https://hfdev1.fhlmc.com/rw"+domain)

function test() {
location.href="https://hfdev1.fhlmc.com/rw"+domain
}
</script>

we are migrating our webapp to a new junction. our endusers access
html files via urls similar
to the following url:
https://www.fhlmc.com/swebapps/sell/...svcr/test.html

our new url path for this same file is at:
https://www.fhlmc.com/rw/docs/mf_svcr/test.html

in case you are wondering, the files were copied over to the new
junction.

what i would like to do is to grab the following
part from the old url:

"/docs/mf_svcr/test.html"

and append it to the new url:

"https://www.fhlmc.com/rw" + "/docs/mf_svcr/test.html"

once I have that done, I would like to redirect
the user to that page. So, all of this happens
behind the scenes.

Would this be possible?

Thanks,
Slash
"McKirahan" <Ne**@McKirahan.com> wrote in message

news:<ktLDb.130599$_M.672066@attbi_s54>...
"slash" <sa*****@gwu.edu> wrote in message
news:30**************************@posting.google.c om...
Hi,
I am new to JavaScript and I have been sifting through the previous
posts about some specific help I need with a redirect problem. No luck
there! Could someone take a look and give me some suggestions. I could
really use some help.

What I am trying to accomplish is the following:
-grab the user bookmarked URL.
-strip some of the URL from the beginning
-pass what's leftover of the URL and append that to a new URL.
-i would then like to call this function in the body tag and pass it
to onLoad

<HEAD>
<script>
var domain=window.location.href;
var domain2 = domain.substr(0,29);
document.write("https://hfdev1.test.com/rw"+domain2")

function test() {
document.location.href="https://hfdev1.test.com/rw"+domain2"
}
</script>
</HEAD>
<body onload="test()">

Thanks,
Slash

Looks like you're on the right track.

However, you should
a) remove the quotation mark after all references to "domain2"
b) remove the prefixes from all references to "location.href".
Could you provide a better example of what you're trying to do?
-grab the user bookmarked URL.


Is this the full URL that invoked the page?
-strip some of the URL from the beginning


What is "some of"? Is the the page's filename?
-pass what's leftover of the URL and append that to a new URL.


What's the format of the new URL?
Are you passing the "some of" as a querystring?
Give the following URL:
http://{domain}/{folder}/page.htm
what do you want stripped out for later use?

Is this what you're looking for?

Watch for word-wrap.
<html>
<head>
<title>redirect.htm</title>
<script language="javascript" type="text/javascript">
<!--
function redirect() {
var href = location.href;
var pref = "https://www.fhlmc.com/swebapps/sell/rworks/";
if (pref == href.substring(0,pref.length)) {
var goto = "https://www.fhlmc.com/rw/";
var page = href.substr(pref.length,href.length);
location.href = goto + page;
}
}
// -->
</script>
</head>
<body onload="redirect()">
</body>
</html>
Jul 20 '05 #6
slash wrote on 17 Dec 2003 at Wed, 17 Dec 2003 13:56:30 GMT:
we are migrating our webapp to a new junction. our endusers
access html files via urls similar
to the following url:
https://www.fhlmc.com/swebapps/sell/...svcr/test.html

our new url path for this same file is at:
https://www.fhlmc.com/rw/docs/mf_svcr/test.html


Have you tried mapping the path /swebapps/sell/rworks to /rw? Any
decent web server should be able to accomplish this. It also means
that your users can carry on using the old URIs without issue. You
might want to tell them that documents have been moved and they
should change their bookmarks, but if you can keep the mapping in
place permanently, there's no reason to do this.

Take a look at the W3C's brief article on this subject, "Cool URIs
don't change":

http://www.w3.org/Provider/Style/URI

It lists some excuses that people might use to justify altering the
directory structure or naming schemes on a server. It also offers
some tips on how to create stable schemes.

Jakob Nielsen (a well-known name in the field of HCI) has also
written an article on this, "Linkrot":

http://www.useit.com/alertbox/980614.html

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #7

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

Similar topics

4
5049
by: Ivo Woltring | last post by:
Hi Pythoneers, I am trying to make my own gui for mencoder.exe (windows port of the terrific linux mencoder/mplayer) to convert divx to Pocket_PC size. My current app creates a batch script to...
10
1853
by: Kenneth Keeley | last post by:
Hi, I have been having problems with Gecko based browsers not redirecting properly. This is the line of code that does the redirecting: Response.Redirect ("Validation.asp?BookingNo=1234567") ...
0
2556
by: Christophe HELFER | last post by:
hi, I have some problem with redirecting input and output from a process. I can only use VB language (sorry...) Situation: I have to use the Cisco Network Registrar (DNS And DHCP server) ...
3
2308
by: lozd | last post by:
Would appreciate any solutions people could offer for this. Basically I wan't to use a frameset with an aspx page as the contents rather than a htm page and I'd like to be able to redirect the...
0
2118
by: Sune Hansen | last post by:
Hi guys, I really hope someone can help me with my problem. Here is the scenario: I have a development environment on my locale machine. Once in a while when everything has been tested I...
1
1846
by: Bilbo | last post by:
Hello, How do I programatically redirect a page in "another frame" using C# in ASP.NET? Server.Transfer redirects the current page...not a different frame. Thanks.
3
2453
by: tony | last post by:
I've been searching through the threads to find a solution for 401.3 error triggered by windows authentication not being able to redirect to a custom error page to no avail. It seems that ASP.NET...
4
1482
by: Greg Smalter | last post by:
Redirecting from page to page within a web project is pretty easy. However, all Redirect methods take strings as arguments, as if you mistype the string, you don't find out until run time that you...
8
5762
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can...
17
9442
by: mansb2002 | last post by:
Hi, We recently moved our webserver from Win2K to Win2003. The application works fine. Only problem is that when user views a report as a PDF, IE does not show it. The following code is used to...
0
7203
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
7087
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...
1
6993
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
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.