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.l ocation.href;
var domain2 = domain.substr(0 ,29);
document.write( "https://hfdev1.test.com/rw"+domain2")
function test() {
document.locati on.href="https://hfdev1.test.com/rw"+domain2"
}
</script>
</HEAD>
<body onload="test()" >
Thanks,
Slash 6 1736 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.l ocation.href; var domain2 = domain.substr(0 ,29);
document.write( "https://hfdev1.test.com/rw"+domain2")
^ that " is wrong
function test() { document.locati on.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/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
"slash" <sa*****@gwu.ed u> wrote in message
news:30******** *************** ***@posting.goo gle.com... 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.l ocation.href; var domain2 = domain.substr(0 ,29); document.write( "https://hfdev1.test.com/rw"+domain2")
function test() { document.locati on.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? sa*****@gwu.edu (slash) wrote in
news:30******** *************** ***@posting.goo gle.com: 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.l ocation.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.locati on.href="https://hfdev1.test.com/rw"+domain2" } </script> </HEAD> <body onload="test()" >
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(2 9);
document.write( "https://hfdev1.fhlmc.co m/rw"+domain)
function test() {
location.href=" https://hfdev1.fhlmc.co m/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.130 599$_M.672066@a ttbi_s54>... "slash" <sa*****@gwu.ed u> wrote in message news:30******** *************** ***@posting.goo gle.com... 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.l ocation.href; var domain2 = domain.substr(0 ,29); document.write( "https://hfdev1.test.com/rw"+domain2")
function test() { document.locati on.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?
"slash" <sa*****@gwu.ed u> wrote in message
news:30******** *************** **@posting.goog le.com... 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(2 9); document.write( "https://hfdev1.fhlmc.co m/rw"+domain)
function test() { location.href=" https://hfdev1.fhlmc.co m/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.130 599$_M.672066@a ttbi_s54>... "slash" <sa*****@gwu.ed u> wrote in message news:30******** *************** ***@posting.goo gle.com... 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.l ocation.href; var domain2 = domain.substr(0 ,29); document.write( "https://hfdev1.test.com/rw"+domain2")
function test() { document.locati on.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="javas cript" 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(pre f.length,href.l ength);
location.href = goto + page;
}
}
// -->
</script>
</head>
<body onload="redirec t()">
</body>
</html>
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.******@blueyo nder.co.invalid (replace ".invalid" with ".uk") This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 run the mencoder with the needed
params, but now I want to integrate mencoder as a subprocess in my app.
What already works:
the starting of the subprocess.Popen
and the subsequent killing of the process if I want it to.
|
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")
The Gecko based browsers change this URL to read "Validation
BookingNo=1234567" and of course they get a 404 Error as a result. The above
code works on every other browser without fault. So why do Gecko based
|
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) command
line utility as redirecting its input and output so I can interact with this
one. This utility is similar to ftp under a win32 console. It proposes its
own prompt after launching it.
|
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 main page from
the code behind the contents page.
I want to do this to allow the use of asp "linkbuttons" instead of
hyperlinks so I can do a little processing before redirecting. The main
reason for this to prevent hyperlinks of pages that have...
|
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 publish it to the live server. This has been
working well for some time.
Now, all of a sudden, when I publish my site it no longer works on the live
server. It seemes as if it keeps redirecting to the same page over and over
| |
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.
|
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 does not redirect 401 errors
yet changing the Custom Errors redirect in IIS does not help either. Has
anyone found a solution to this problem? Seems like it should be a commonly
encountered problem. Any help will be greatly appreciated.
|
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 are redirecting to somewhere that
doesn't exist.
Worse, if you do type it correctly, but then later the page name changes or
the page moves, you still won't find out until run time.
I have a framework that solves this problem and guarantees,...
|
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 technically create an executable that calls the function and then
using a command prompt call the exexutable using the > output.txt
redirector but I would prefer to do everything within the application
itself. Is there a way for force an output...
|
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 redirect:
Response.Redirect("/website/pdffiles/myreport.pdf");
Response.End;
IE opens a "File Download" box and if you click the "open" button then
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |