Yesterday I was looking at XHTML and accessibility standards for BlogEngine.NEXT and found something I haven’t noticed before in the W3C specs. I came across some rules about specifying the default script and style sheet language when trying out the Total Validator.

By specifying the default script language you tell the browser what language all the onclick and other events specified in the HTML should be interpreted in. It’s probably always text/javscript but it could be text/vbscript or something else.

The same goes with the style sheet type. It’s always text/css when you use the style attribute in the HTML.

To tell the browser about the default script language and style sheet type, you can either add meta-tags or custom HTTP headers.

The meta-tags

<META http-equiv="Content-Style-Type" content="text/css">
<META http-equiv="Content-Script-Type" content="text/javascript">

The HTTP headers

Response.AppendHeader("Content-Style-Type", "text/css");
Response.AppendHeader("Content-Script-Type", "text/javascript");

The headers should be added to all .aspx pages. The easiest way to do that is in the master page or global.asax.


Comments are closed