Somehow the <base> tag remains unknown to most of the web developers, but that’s quite normal. However let see what it can do. By adding the <base> tag in the head of the page you tell every link into that page how to open and a default href value. Thus if you have:
every link without a href attribute will open this link. That’s really useful in some cases. However the most interesting part of the base tag is the target attribute.
Everybody knows what will result from this attribute attached to a anchor tag.
<a href="http://www.stoimen.com" target="_blank">Click Here</a>
But with only adding this base tag:
into the head … all the links will open in a new tab/window, depending on the browser preferences.
If you add the line above somewhere into the <body> tag the browser, will put it into the <head> which will make it difficult to track. A good practice is to place it directly into the <head>!
- How to Collect the Images and Meta Tags from a Webpage with PHP
- Html object & embed tags
- Change the Viewport, be Ready for the iPhone!
- HTML Tag Semantics. STRONG vs. B!
- a tag doesn’t apply hover on IE6