Featured Posts

Our Life as We Know itOur Life as We Know it October marked the time when life, my life that is, turn upside down. Well, o.k. not really upside down, but it sounded good in my head. Can't you hear the symphony in the...

Readmore

Creating Fluid Web Pages using Image BordersCreating Fluid Web Pages using Image Borders This week I have been working on a redesign of one of my web sites. The design of the website was acceptable by my client, but the desire was to maintain the same look of...

Readmore

Link Exchanges/Link Farms - Good or Bad The other day, I received a very courteous email from a webmaster looking to increase the rankings of his web pages. I have spent the last few days contemplating his request. First,...

Readmore

Google's New CaffeineGoogle's New Caffeine I am a sucker for Google's search engine. I use it over any other. However, from time to time I do look at the others just to see if I am missing anything special. Usually,...

Readmore

TeacherTube ReviewTeacherTube Review As a web designer, I help clients with video uploads quite a bit. One network that I have been known to use for video uploads is TeacherTube.com. The rules seem pretty...

Readmore

Hafner Designs Rss

Difference between “text/javascript” & “application/javascript”

Posted on : 04-03-2009 | By : Heidi Hafner | In : Relocation, Web Design

Tags: ,

1

I learned something interesting yesterday. All these past years, when I have to use javascript in a web page, I have always put one of these as my link to my javascript inside my head tags:

script type=”text/javascript” src=”scripts/anyscript.js”
script src=”scripts/anyscript.js”

However, in my endeavors to write cleaner pages, use new code instead of obsolete or deprecated code, and also to learn Dreamweaver CS4, I set my tag to be:

script type=”application/javascript” src=”scripts/anyscript.js”

Usually I test all my pages before I let my clients know that they’re done… but this time I didn’t. Shortly after releasing them, I found that the javascript, which I use in many pages only worked in Firefox or Safari, but it did not work in Microsoft IE.

I went through all my code trying to figure out what the deal was… you know, looking for the proverbial needle in a haystack! Couldn’t find it. Finally, it occurred to me that I had tried this new thing that Dw offered, type=”application/javascript”. I quickly changed back to my tried and true, type=”text/javascript”.

Apparently, The W3C (HTML) specification suggests using text/javascript instead of application/javascript.

I found a post by Microsoft that says, “This is an expected by-design behavior. IE currently does not have support for these media types.” This was in reference to the media type of “application/javascript” or “application/ecmascript.”

Well, this web designer is sticking to the old tried and true “text/javascript” for now. No use making more trouble in my designs.

More later…

Technorati Tags: ,

Comments (1)

I had the same problem. Spent an hour trying to work out what was wrong with my onload function before i finally noticed that application/javascript was been used instead of text/javascript.
I had only checked it in Firefox. so of course something was going to go wrong in IE!

Write a comment