Opening a secondary window/tab with base element located in document's "head" section

I have a list of links to college/university web sites… there are SO MANY links on the web page that I would like to add a “base” element to the document header specifying that all links will open by default in a new browser window/tab named “collegeWin”.]

How would this be done?

I found the answer on page 109 of Elizabeth Castro’s Visual Quickstart Guide; to wit…

<base target=“winCollege” />

Yeah, there’s more info about this in the SitePoint reference section, in case you need it:

Yeah, that’s great but now there are a few targets that I DON’T want a new window, now that I got the base set. How do I deal with that? I’ll keep looking.

wow, that was quick! I found the answer! It is from Sitepoint Web Foundations (of all places)
=> target (HTML attribute)

“_self” loads content in the same frame (This attribute isn’t normally required, as this is the default behavior unless the baseelement specifies otherwise. In that case, you’d need to override the specification using “_self”; for example, .)


<p>You can try our <a href="cakes.html" target="_self">lovely range of cakes</a>.</p>

Note that the target attribute was flagged as obsolete back in 1997. Since then you are supposed to let your visitors choose where they want links to open. Without target they get at least three different choices. With target you effectively remove one of their choices if they don’t know how to put it back.

Some people also configure their browser so that certain types of link open by default the way they want regardless of any obsolete target attributes the page may use. For example I don’t like new tabs or windows being opened by web pages so I have my browsewr set to always open links in the current tab (except when I right click and choose differently).

FYI - In HTML5 the target attribute is no longer deprecated a - hyperlink :wink:

The reason for removing it still exists though - all it does is remove choices from those web users who don’t know how to override it.

Anyway HTML 5 isn’t a finished standard yet. There is still time for them to review the reasons for making tags and attributes obsolete back in 1997 and to reapply them to HTML 5 before it becomes a standard except in the rater case where the reason no longer applies.

The browser owner should be allowed to decide where they want links to open and you will lose visitors if you use that attribute and your visitor doesn’t know how to override it so it all depends if you want to keep people on your site or not.