471,122 Members | 1,126 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

BASE HREF tag

Is there a way to get Javascript to obey the <BASE HREF=""> tag? I
have some code that redirects a user to a template on a different
domain, but it keeps taking me to the current domain.

Code sample:
<base href="http://www.example.com">

<SELECT onChange="location=this.options[this.selectedIndex].value;">
<OPTION VALUE="shwspool.html">View Spool Directory</OPTION>
<OPTION VALUE="monacc.html">View Monitor Access Log</OPTION>
<OPTION VALUE="monsys.html">View Monitor System Log</OPTION>
</select>

Any help would be greatly appreciated!

Jul 20 '05 #1
3 13652
Lee
John said:

Is there a way to get Javascript to obey the <BASE HREF=""> tag? I
have some code that redirects a user to a template on a different
domain, but it keeps taking me to the current domain.

Code sample:
<base href="http://www.example.com">


Off the top of my head, that's not a valid base href value.
Try:

<base href="http://www.example.com/">

Jul 20 '05 #2
On 26 Jun 2003 20:44:57 -0700, Lee <RE**************@cox.net> wrote:

:John said:
:>
:>Is there a way to get Javascript to obey the <BASE HREF=""> tag? I
:>have some code that redirects a user to a template on a different
:>domain, but it keeps taking me to the current domain.
:>
:>Code sample:
:><base href="http://www.example.com">
:
:Off the top of my head, that's not a valid base href value.
:Try:
:
:<base href="http://www.example.com/">

It still didn't solve my original problem, however :(
Jul 20 '05 #3
John Smith <3r*********@sneakemail.com> writes:
Is there a way to get Javascript to obey the <BASE HREF=""> tag? I
have some code that redirects a user to a template on a different
domain, but it keeps taking me to the current domain.

Code sample:
<base href="http://www.example.com">

<SELECT onChange="location=this.options[this.selectedIndex].value;">
<OPTION VALUE="shwspool.html">View Spool Directory</OPTION>
<OPTION VALUE="monacc.html">View Monitor Access Log</OPTION>
<OPTION VALUE="monsys.html">View Monitor System Log</OPTION>
</select>


Try something like:

function goto(url) {
location.href = document.getElementsByTagName('base')[0].href + url;
}
...
<select onchange="goto(this.options[this.selectedIndex].value)">

(warning:untested)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Harag | last post: by
6 posts views Thread by Jeff Thies | last post: by
1 post views Thread by Jeff Thies | last post: by
1 post views Thread by just1coder | last post: by
3 posts views Thread by SJ | last post: by
3 posts views Thread by Guoqi Zheng | last post: by
2 posts views Thread by Vincent van Beveren | last post: by

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.