Home  |  About  |  Map  |  Privacy  |  Disclaimer  

www.TexaStar.com

Web & Software Development & Consulting


This is a test

of the XHTML 1.1 Target Module.

Introduction

When deciding what XHTML specification to development in, XHTML Loose is a tempting choice because it's pretty much exactly like HTML 4.0. XHTML Transitional is a close second, because not much more laziness need be given up to perform to that standard. However with XHTML Strict, a few more tags have to be modified in order to successfully make the transition. The most annoying one to my mind has been the loss of the anchor element's target attribute. However, a little more effort can bring you to the most current of the XHTML standards, XHTML 1.1, as well as return the lamented target functionally.

target attribute deprecated in XHTML

HTML 4.01 deprecated the target attribute which could be used with links so they would open in a new window. Consequentially this attribute was deprecated in the XHTML 1.0 standard. The deprecation of this attribute did not change the web designer's desire to open certain links is a new browser window. The following is an example of an HTML 4.01 transitional HTML document using the target attribute.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    <html>
      <head>
        <title>Example of a Target Attribute</title>
      </head>
      <body>
        <p>
          <a href="http://www.TexaStar.com" 
             target="_blank">TexaStar</a> 
        </p>
      </body>
    </html>

JavaScript window object solution:

Javascript provides a partial solution to the problem by passing the href attribute to the window object's open method, and returning a value of false. The false return from the event handler prevents the web browser from following the link specified in the href attribute.

    <a href="http://www.TexaStar.com" 
       onclick="window.open(this.href); return false;"
       onkeypress="window.open(this.href); return false;">TexaStar</a> 

This previous example provides an onclick event handler for those using a pointing device, and an onkeypress event handler for those using a keyboard. However, when JavaScript isn't enabled, the link is processed as normal, providing a possibly adequate fallback mechanism, but failing to produce the designer's desired result.

XHTML 1.1

XHTML 1.1 Modularization [ XHTMLMOD] breaks down XHTML 1.0 Strict and by reference HTML 4, into a collection of abstract modules that provide specific types of functionality. Instead of having one huge DTD that defines everything; modules are used as needed and supported by device. To ensure the basis of XHTML is consistent, four core modules are specified.

XHTML Core Modules
Module Name Module Description DTD Fragment
Hypertext Hypertext Module Definition. Hypertext Module Implementation.
List List Module Definition. List Module Implementation.
Modular Framework Module Modular Framework Module Definition. Modular Framework Module Implementation.
Text Text Module Definition. Text Module Implementation.

In addition to the four core modules, a number of additional abstract modules are defined.

XHTML Abstract Modules
Module Name Module Description DTD Fragment In XHTML 1.1 DTD?
Applet Applet Module Definition. Applet Module Implementation (deprecated). No
Base Base Module Definition. Base Module Implementation. Yes
Basic Forms Basic Forms Module Definition. Basic Forms Module Implementation. Yes
Basic Tables Basic Tables Module Definition. Basic Tables Module Implementation. Yes
Bi-Directional Text Bi-Directional Text Module Definition. Bi-Directional Text Module Implementation. Yes
Client-Side Image Map Client-Side Image Map Module Definition. Client-Side Image Map Module Implementation. Yes
Edit Edit Module Definition. Edit Module Implementation. Yes
Forms Forms Module Definition. Forms Module Implementation. No
Frames Frames Module Definition. Frames Module Implementation. No
Iframe Iframe Module Definition. Iframe Module Implementation. No
Image Image Module Definition. Image Module Implementation. Yes
Intrinsic Events Intrinsic Events Module Definition. Intrinsic Events Module Implementation. Yes
Legacy Legacy Module Definition. Legacy Module Implementation. (elements in this module are already deprecated by previous versions of HTML and XHTML) No
Link Link Module Definition. Link Module Implementation. Yes
Metainformation Metainformation Module Definition. Metainformation Module Implementation. Yes
Name Identification Name Identification Module Definition. Name Identification Implementation. (deprecated) No
Object Object Module Definition. Object Module Implementation. No
Presentation Presentation Module Definition. Presentation Module Implementation. Yes
Ruby Annotation Ruby Module Definition. Ruby Module DTD. Yes
Scripting Scripting Module Definition. Scripting Module Implementation. Yes
Server-Side Image Map Server-Side Image Map Module Definition. Server-Side Image Map Module Implementation. Yes
Style Attribute Style Attribute Module Definition. Style Attribute Module Implementation (deprecated). Yes
Style Sheet Style Sheet Module Definition. Style Sheet Module Implementation. Yes
Tables Tables Module Definition. Tables Module Definition Implementation. No
Target Target Module Definition. Target Module Implementation. No

Implementing XHTML 1.1

As noted in the above table, some of the modules are not included by default in the XHTML 1.1 DTD. These modules may be used to extend the basic DTD to incorporate desired functionality. Below is a sample DTD which can be hosted on your site, or reference from our site, to bring in the target module and allow the specification of a target attribute in the anchor element.

<?xml 
  version="1.0" 
  encoding="iso-8859-1"?>
<!-- 
    XHTML 1.1-with Target
-->
<!--
    ENTITIES XHTML 
    data types module for basic data types
-->
<!ENTITY % xhtml-datatypes.module "INCLUDE"> 
  <![%xhtml-datatypes.module;[ 
    <!ENTITY % xhtml-datatypes.mod 
      PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
      "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-datatypes-1.mod"> 
%xhtml-datatypes.mod;]]>
<!--
    ENTITIES Qualified Name  
    namespace declarations and parameter entities
-->
<!ENTITY % xhtml-qname.module "INCLUDE"> 
  <![%xhtml-qname.module;[ 
    <!ENTITY % xhtml-qname.mod 
      PUBLIC "-//W3C//ENTITIES XHTML Qualified Names 1.0//EN"
      "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-qname-1.mod"> 
%xhtml-qname.mod;]]>
<!-- 
    XHTML 1.1 driver DTD
-->
<!ENTITY % xhtml11.dtd 
  PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
%xhtml11.dtd;
<!-- 
    Target Module
-->
<!ENTITY % xhtml-target.module "INCLUDE">
  <![%xhtml-target.module;[ 
    <!ENTITY % xhtml-target.mod 
      PUBLIC "-//W3C//ELEMENTS XHTML Target Module//EN"
      "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-target-1.mod"> 
%xhtml-target.mod;]]>

The final step of this process is to create a web page utilizing this functionally, and accessing the modular DTD with the following DOCTYPE.

<!DOCTYPE html 
  PUBLIC "-//TexaStar//DTD XHTML11-with Target//EN"  
  "http://www.TexaStar.com/DTD/xhtml11-target.dtd">

This page, and others on this site are implemented using the demonstration DTD and you may view more details by viewing the of this document you are viewing. Furthermore, use the links at the bottom of this page to validate it against the CSS, XML and 508/AAA specifications.The Test Target Link from the top of the page, is shown here for reference.

<a
  href="http://www.texastar.com"
  class="emphasis"
  target="_blank"
  onclick="window.open(this.href); return false;"
  onkeypress="window.open(this.href); return false;">Test
  Target Link</a>

Final Thoughts

Given that the XHTML 1.1 Modularization use of the Target Module provides full target functionally, it begs the question of whether or not one should continue to use the onclick and onkeypress JavaScript methods previously mentioned. As alwasy it is a choice based on the preferences of the designer, skill of the developer, financial backing of both, and the target audience.

Old browser agents do not support XHTML. JavaScript may be unsupported or disabled. JavaScript was only first introduced in the Netscape Browser version 2.0 in December 1995. The simplest fallback being completely to ignore the target attribute and linking to the page in the current browswer window contrary to the designer's intent.

Therefore, the most robust implementations to reach the broadest audience with the design intent would reqire the implementation of the XHTML 1.1 Target Module, as well as inclusion of both the onclick and onkeypress event handlers as displayed above.

  Home  |  About  |  Map  |  Privacy  |  Disclaimer  

Sign up for a web site with TexaStar Hosting

Written by: Erik McCarty <erik@texastar.com>
Last modified: 2004-02-08


   Maintained by TexaStar.com

Copyright © 2003
TexaStar.com



This page is designed for all browsers and devices and is authored to W3C recommendations including XHTML 1.0 Transitional and Cascading Style Sheets. It is Bobby Approved to the WAI Content Accessibility Guidelines 1999/05/05, Support Level: AAA and complies with the U.S. Section 508 Guidelines: Electronic and Information Technology Accessibility Standards. As a result, this web page displays as intended in Opera 5, Opera 6, MSIE5, MSIE4 MacIntosh Edition , MSIE5.5, MSIE6, Netscape 6, and title="External Link: Mozilla" Mozilla (possibly the best browser ever), while its text is available to any browser or Internet device, from Netscape 1.0 to Palm Pilots and web phones, and in those displays is intended to degrade to a readable and logically organized layout.