An ingenious and ingenious way to force a link to open in a new tab / window, without using the
target attribute undesired on the recommendation of the W3C in XHTML:
<a onclick=roomreturn !window.open(this.href) hréf==
www.google.com »>
The advantages of this method over the usual
open.window (url) is that if javascript is disabled, the link will still work. In addition, the link will be indexed by search engines.
')
Tested in FF2, IE6 / 7, Opera 9.20, Safari / Win.
<update>Browser behavior when pressing Ctrl + Click / Shift + Click:
In IE6, in both cases a new window.
In IE7 - in both cases, the new tab (I suspect it depends on the browser settings)
In FF2 - inadequate. ctrl + click opens two tabs, shift + click tab and window
Opera - in both cases, the new tab
Safari / Win - in both cases, a new window
When you click the mouse wheel, the link works as usual everywhere except IE6, of course.
</ update>In general, it is not necessary to force visitors to something, it is preferable to let the visitor know what kind of link itself (file [including type], external / window) using icons that can be easily screwed using CSS, for example
like this , thereby giving him the opportunity to choose for himself where to open it.