Default script and style language

by Mads Kristensen 29. December 2008 00:35

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.

* Only $4.95/month ASP.NET & Windows 2008 + IIS 7 Hosting! FREE SQL Included

Tags: , , ,

Client-side

Comments

12/29/2008 4:02:18 AM #

Rainer

<META http-equiv="Content-Script-Type" content="type"> should be
<META http-equiv="Content-Script-Type" content="text/javascript">

Rainer Finland |

12/29/2008 7:55:10 AM #

Mark Johnston

I also have recently come across this that I had never seen before as I have been making one of our sites 100% compliant.

Mark Johnston Australia |

12/29/2008 3:25:47 PM #

Mads Kristensen

@Rainer,

A silly copy/paste error. It's fixed now. Thanks.

Mads Kristensen Denmark |

1/1/2009 12:11:49 PM #

吴鹏(AlphaWu)

Happy New Year.
Happy 牛 Year.

Thanks BlogEngine.

吴鹏(AlphaWu) |

1/6/2009 4:27:37 PM #

Petr

IMHO It's wasting of bandwidth...

Petr Czech Republic |

2/25/2009 9:12:56 PM #

Web Conferencing

I really appreciate this kind of stuff. It helped me with ocean of knowledge so I really believe you will do much better in the future.

Web Conferencing United States |

Comments are closed

About the slave

Mads Kristensen Mads Kristensen
Web developer at ZYB and founder of BlogEngine.NET. More...

LinkedIn ZYB Facebook Last.fm Twitter View Mads Kristensen's profile on Technorati

The Lounge

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008