The best magazine
Ways to Open New Windows in XHTML
- How you open a new window depends on whether you use XHTML Transitional or Strict.Ryouchin/Digital Vision/Getty Images
Extensible Hypertext Markup Language (XHTML) is an XML markup language for coding Web pages that extends HTML. Before HTML5, HTML was part of SGML (Standard Generalized Markup Language), but XHTML is part of XML, which is more restrictive. So XHTML formatting is stricter than HTML. Opening a new browser window in XHTML is done differently than in HTML. - In regular HTML, the way you open a link in a different window is to use the "target" attribute to your <a href></a> tag that you use to create a hyperlink. Target="_new" or target="_blank" will force the URL, when clicked upon, to open in a separate browser window.
- In XHTML 1.0 Transitional, you can also use the "target" attribute.
- To open a new window in XHTML 1.0 Strict, the officially correct way is to use Javascript to set up an on-click handler with an "OpenWindow()" command. Another option is to give an attribute to links you want to open in a separate window and use Javascript to add the target attribute to the links. However, browsers will still open a new window if you use the "target" attribute, but this method will not officially validate using an XHTML 1.0 Strict validator.
Regular HTML
XHTML 1.0 Transitional
XHTML 1.0 Strict
Source: ...