f



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!



0
6/27/2003 2:42:30 AM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

3 Replies
1106 Views

Similar Articles

[PageSpeed] 32

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/">

0
Lee
6/27/2003 3:44:57 AM
On 26 Jun 2003 20:44:57 -0700, Lee <REM0VElbspamtrap@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 :(


0
John
6/27/2003 4:13:44 AM
John Smith <3rtwemte001@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  -  lrn@hotpop.com
 Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
  'Faith without judgement merely degrades the spirit divine.'
0
Lasse
6/27/2003 10:16:12 AM
Reply: