The Base tag.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

The Base tag.

Post by onion2k »

This should be a really simple question but I can't find the answer anywhere online. Is the <base> tag universally supported (all browsers, all operating systems)? It's a much nicer approach when I'm rewriting URLs to include '/'s than using absolute paths on everything.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Well, I never heard it's not... so I guess it is (universally supported) :P

Edit: If you go here: http://meiert.com/en/indices/html-elements/ it says it is valid HTML 3.2, HTML 4.01, XHTML 1.0, XHTML 1.1 and HTML 5, so I guess you can use it :wink:
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

True, it seems that way. But most blog software doesn't use it which leads me to think there's something dodgy about it.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

I've used the tag in my own CMS software and commercial software which I developed. The company I currently work for has used and sold software that relied on it to tens of thousands of people, haven't had a complaint yet. :)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I used to use it a lot more. Then I started working with miva and found that there is no easy way (within miva - have I mentioned that I hate miva?) to do something like this:

Code: Select all

<a href="#some-point-on-the-page">This is cool</a>

because that takes you back to whatever the value of base href is. so you go to $basehref#some-point-on-the-page which is rarely what you want. This probably isn't so much of a problem in php because it's easy to find what page you're currently on.
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

I experimented with it for phpFe (to save bandwidths), but it didn't work out very well - I think I had some issues with browsers behaving differentely.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

vigge89 wrote:I experimented with it for phpFe (to save bandwidths), but it didn't work out very well - I think I had some issues with browsers behaving differentely.
Can you elaborate? I've tested it in IE6, FF2, Opera and Safari and they're all working ok. Where did you have problems?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

The Ninja Space Goat wrote:I used to use it a lot more. Then I started working with miva and found that there is no easy way (within miva - have I mentioned that I hate miva?) to do something like this:

Code: Select all

<a href="#some-point-on-the-page">This is cool</a>

because that takes you back to whatever the value of base href is. so you go to $basehref#some-point-on-the-page which is rarely what you want. This probably isn't so much of a problem in php because it's easy to find what page you're currently on.
Dude. Your my hero. :P

Seriously, your a life saver...this is exactly why I am having the problem with this topic:

viewtopic.php?t=70593

Unfortunately I need <base> tag so I will have to come up with an alternative method, but you just saved me tons of effort in research and investigation. Next beer is on me (not literally of course). ;)

Cheers :)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

@hockey - :) glad I could help


@onion - I remember when I discovered the base tag I had the same reaction - "Why did I just find out about this?? It's brilliant!"
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

onion2k wrote:
vigge89 wrote:I experimented with it for phpFe (to save bandwidths), but it didn't work out very well - I think I had some issues with browsers behaving differentely.
Can you elaborate? I've tested it in IE6, FF2, Opera and Safari and they're all working ok. Where did you have problems?
I'm afraid I don't really remember, think IE (6 if I remember correctly) ignored the tag completely.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I'm afraid I don't really remember, think IE (6 if I remember correctly) ignored the tag completely.
nope
Post Reply