target=”_blank” validation

target=”_blank” is not valid code within webpages with a strict doctype declaration.

A valid replacement is :

<a href = “http://www.example.com” onclick = “window.open(this.href); return false;”>my link </a>

The onclick=”window.open(this.href); return false;”  is an inbuilt javascript method and needs a <meta> declaration  to work properly in in xml, strict xhtml or html4 source code pages.

<meta http-equiv=”Content-Script-Type” content=”text/javascript”>

target=”_blank” is however 100% valid in HTML5.

mobileOK Checker

mobileOK

W3C provides a mobileOK checker to perform various tests on a Web Page to determine its level of mobile-friendliness. The tests are defined in the mobileOK Basic Tests 1.0 specification.

The checker is based on the open source mobileOK checker library developed by the Mobile Web Best Practices working group.

The mobileOK checker is part of the MobiWeb2.0 Project and of W3C Quality Assurance Tools.

mobileOK conformance can be claimed using POWDER.

XHTML validation and Javascript : CDATA

With HTML pages on the web you can include the required Javascript betweentags. The W3C validator ignores the Javascript content. The same is not true for XHTML where the code between the script tags is considered to be PCDATA (parsed character data) which is therefore processed by the validator.

The result is a break of the page validation. To fix this problem, one solution is to make the Javascript external to the page. Another solution is to  place the Javascript code within a CDATA tag. However some older web browsers don’t understand the CDATA tag and this breaks the Javascript in those browsers.

If the CDATA tag is commented out, the Javascript code is handled correctly both by newer browsers and by validators and ignored by older browsers and the page is displayed as expected in all cases.

<script type=”text/javascript”>
/* <![CDATA[ */
// content of your Javascript goes here
/* ]]> */
</script>

A guide about this topic has been written by Stephen Chapman on the About.com:Javascript website.