OZONE Asylum
FAQ
Is there an equivalent to the target link attribute for XHTML?
This page's ID:
5332
Search
QuickChanges
Forums
FAQ
Archives
Register
You are editing "Is there an equivalent to the target link attribute for XHTML?"
Who can edit an FAQ?
Anyone registered may edit an FAQ.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
We recommend you use the following in the place of the target attribute (which has been depreciated in XHTML): --------------------------------- Relevant threads: [url=http://www.ozoneasylum.com/Archives/Archive-000003/HTML/20030822-8-000411.html]XHTML Strict alternative for "target"?[/url] [url=http://www.ozoneasylum.com/Archives/Archive-000003/HTML/20030822-8-000250.html]XHTML 1.1 - strict[/url] [url=http://development.gurusnetwork.com/discussion/thread/2196/]XHTML, target=_blank, JavaScript and the referrer[/url] - discussion at the GN about the problem of the referer not being sent with the JavaScript solution. --------------------------------- Solutions: [b]JavaScript[/b] [code]onclick="window.open(this.href,'_blank');return false;"[/code] 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'); }[/code] 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[/code] --------------------------------- Relevant links: [url=http://www.youngpup.net/?request=/articles/how-to-create-popups.xml]How to Create Pop-Up Windows[/url] [url=http://development.incutio.com/simon/targetBlankExperiment.html]Target Blank in XHTML[/url] - a rather scary JavaScript hack which adds the target attribute to links. [url=http://www.serve.com/apg/workshop/replacingTarget/]Standards-based Replacement for target="_blank" in External Links[/url] [url=http://www.sitepoint.com/article/1041]New-Window Links in a Standards-Compliant World[/url] [b]XHTML 1.1+ Target Module[/b] 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: [URL=http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_targetmodule]XHTML Target Module[/URL] [URL=http://www.w3.org/TR/xhtml-modularization/]XHTML Modularization specifications[/URL] [url=http://www.uninetnews.com/xhtml/xhtmlversions.php]XHTML Versions Demystified[/url] --------------------------------- Relevant notes: As of the time of writing this FAQ was ranked 2 at Google for the terms [url=http://www.google.com/search?q=xhtml+strict+target+alternative]xhtml, strict, target, alternative[/url] (the first Asylum thread is number 1). _________________________ [internallink=4626]Emperor[/internallink] [small][i](Edited by: [url=http://www.ozoneasylum.com/cgi-bin/ubbmisc.cgi?action=getbio&UserName=Tyberius+Prime]Tyberius Prime [/url] on Wed 20-Aug-2003)[/i][/small] [small][i](Edited by: [url=http://www.ozoneasylum.com/cgi-bin/ubbmisc.cgi?action=getbio&UserName=Emperor]Emperor [/url] on Fri 22-Aug-2003)[/i][/small] [small](Edited by [url=http://www.ozoneasylum.com/user/6282]CyBot[/url] on 08-20-2006 16:04)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »