By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,380 Members | 1,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,380 IT Pros & Developers. It's quick & easy.

BASE HREF tag

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.