Open a New Browser Tab With JavaScript
I just came across this entry over at Larry Williams’ Blog explaining how to open a link in a new tab. Pretty interesting, and kudos to Larry for figuring this out. It just seems to me that there should be a way to do with without JavaScript. Wouldn’t that be more usable?
I mean, there are special names to use in the target
to do things such as open a new window (_blank
), open in a parent window (_parent
), etc. IE and Mozilla also provide the _search
value to open links in the search sidebar. Wouldn’t it make sense for Mozilla to support a value like _tab
to open a link in a new tab? That way, it would fail gracefully in non-supporting browsers by opening a new window instead.
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.