Default script and style language

Dec 28, 2008

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.

* $4.95/month BlogEngine.net Hosting – Click Here!

Comments (6) -

Rainer
Rainer Finland
12/28/2008 7:02:18 PM #

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

Mark Johnston
Mark Johnston Australia
12/28/2008 10:55:10 PM #

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

Mads Kristensen
Mads Kristensen Denmark
12/29/2008 6:25:47 AM #

@Rainer,

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

吴鹏(AlphaWu)
吴鹏(AlphaWu)
1/1/2009 3:11:49 AM #

Happy New Year.
Happy 牛 Year.

Thanks BlogEngine.

Petr
Petr Czech Republic
1/6/2009 7:27:37 AM #

IMHO It's wasting of bandwidth...

Web Conferencing
Web Conferencing United States
2/25/2009 12:12:56 PM #

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.

Comments are closed

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.