Welcome to the OzoneAsylum FaqWiki
Frequently Asked Questions
HTML

Is there an equivalent to the target link attribute for XHTML? Pages that link to <a href="https://ozoneasylum.com/backlink?for=5332" title="Pages that link to Is there an equivalent to the target link attribute for XHTML?" rel="nofollow" >Is there an equivalent to the target link attribute for XHTML?\

We recommend you use the following in the place of the target attribute (which has been depreciated in XHTML):

---------------------------------
Relevant threads:

XHTML Strict alternative for "target"?

XHTML 1.1 - strict

XHTML, target=_blank, JavaScript and the referrer - discussion at the GN about the problem of the referer not being sent with the JavaScript solution.

---------------------------------
Solutions:

JavaScript

code:
onclick="window.open(this.href,'_blank');return false;"



However, this appears to not work in IE5/Mac (probably due to the DOM defaulting to features being turned off rather than being switched on). This does appear to work:

Put this in the head or external file:

code:
function targetBlank (url) {
  blankWin = window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
}



and this in the page to call the function:

code:
<a href="http://www.domain.com" onclick="targetBlank(this.href);return false;">The GN in a new window</a> using Emps' reduced function




---------------------------------
Relevant links:

How to Create Pop-Up Windows

Target Blank in XHTML - a rather scary JavaScript hack which adds the target attribute to links.

Standards-based Replacement for target="_blank" in External Links

New-Window Links in a Standards-Compliant World

XHTML 1.1+ Target Module

More recent versions of XHTML allow modularization and there is a Target Module which gives us back the ability to use the target attribute.

---------------------------------
Relevant links:

XHTML Target Module

XHTML Modularization specifications

XHTML Versions Demystified

---------------------------------
Relevant notes:

As of the time of writing this FAQ was ranked 2 at Google for the terms xhtml, strict, target, alternative (the first Asylum thread is number 1).

_________________________
Emperor

(Edited by: Tyberius Prime on Wed 20-Aug-2003)

(Edited by: Emperor on Fri 22-Aug-2003)
(Edited by CyBot on 08-20-2006 16:04)

« BackwardsOnwards »

Show Forum Drop Down Menu