473,668 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="locat ion=this.option s[this.selectedIn dex].value;">
<OPTION VALUE="shwspool .html">View Spool Directory</OPTION>
<OPTION VALUE="monacc.h tml">View Monitor Access Log</OPTION>
<OPTION VALUE="monsys.h tml">View Monitor System Log</OPTION>
</select>

Any help would be greatly appreciated!

Jul 20 '05 #1
3 13956
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*********@sn eakemail.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="locat ion=this.option s[this.selectedIn dex].value;">
<OPTION VALUE="shwspool .html">View Spool Directory</OPTION>
<OPTION VALUE="monacc.h tml">View Monitor Access Log</OPTION>
<OPTION VALUE="monsys.h tml">View Monitor System Log</OPTION>
</select>


Try something like:

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

(warning:untest ed)
/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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4138
by: Harag | last post by:
Hi all I'm using W2k Pro, ASP 3, IIS 5 & DWMX 6.1 and code in VBSCRIPT I currently use the <BASE href=XXXX> in all my pages and just read that this tag is no longer supported so will soon vanish I have a couple of sites that I'm working on and to make all my links work right etc I need to use the base href tag
6
5788
by: Jeff Thies | last post by:
I have some pages where I need to use a base href tag. Mac behaviour is different than PC. I have this: <base href="http://some_domain.com" /> The page would be: some_domain.com/some_directory/some_page.htm
1
1982
by: Jeff Thies | last post by:
I have a template driven site, the template is full of images and links. At some point (during a secure order) the user is redirected to a secure server (different domain) using the same template. Now, I want the links to point back to the old insecure domain. I could use a base href to do that (links are all / relative, ie: /info.html) but then the images (also root referenced) would be drawn from the insecure domain and there might...
1
2824
by: just1coder | last post by:
Is there a way to programmatically change the base href tag in a website with JavaScript?
10
7849
by: Udi Zisser | last post by:
Hello, any idea why this does not work? or how do i get this thing to work? <BASE HREF="http://localhost/thedude/"> <META HTTP-EQUIV="Refresh" CONTENT="0; URL=redirect.html"> I'm adding the <base> tag to the content of an existing html that contains a redirect meta tag.
3
4581
by: SJ | last post by:
Hi, I have a problem with the HTML <base> element, URL re-writing and Postback. We are using URL re-writing on the server, and I'd like to use the base element to make the URLs in the ASPX pages more maintainable. Otherwise, we have to manually output the application root eg. src="<%= AppRoot %>". This is cumbersome and hard to maintain. However, there seems to be no way - apart from a client-side script - to rewrite the action...
3
2676
by: Guoqi Zheng | last post by:
Dear sir, On some of my pages, I used a <base href="http://www.meetholland.com/"> I need to dynamically determine the base href value to different URL based on user session. I am thinking to use <base id="baseUrl" runat=server>, it seems not to work. It returns an error of missing </base> but base tag does not need </base>
2
5143
by: Vincent van Beveren | last post by:
Hey everyone, I've looked for this and I wouldn't know what the best practice would be for solving the following problem. We use a BASE tag in our HTML pages. Now we have some links that use the <A HREF="#" onclick="...">Hello</Amethod to invoke a JavaScript. However, because of the BASE tag, when clicking a link containing only a # as 'href' it will load the root index.html file. What I want is it to do nothing and execute the...
3
12847
by: yan | last post by:
Hello everybody, I am new so this is the occasion to say hello to everybody. I have a problem with absolute/relative paths. I have to create a static documentation in html for a project and I have to create an index page in every sub-directory. The structure is like the following: / /sources/ /docs/ /docs/doc1 /share
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8378
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
Oralloy
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...
0
8791
jinu1996
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...
0
8653
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 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...
0
7398
agi2029
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...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
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...
0
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.