Tutorial

application/javascript in IE

Here you will not find any change in the javascript code but please notice that type attribute in script declaration. Those are text/javascript and application/javascript.

Recently I was wrinting a very basic javascript code. Code is as below:
[cc lang=”javascript”][/cc]
Isn’t this really simple? After just writing this I have start testing of this.

FireFox -> Working
Opera -> Working
Chrome -> Working
Safari -> Working
IE -> Not Working

I have done lots of searching over net for number of hours. But not found even a ray of hope for this problem.

Finally i have written the whole code again, and it starts working in all browser. Below is the new code:
[cc lang=”javascript”][/cc]
Here you will not find any change in the javascript code but please notice that type attribute in script declaration. Those are text/javascript and application/javascript.

I don’t know whats the difference between these two but when you place application/javascript in your type attribute then Internet Explorer will completely ignore the script code.

So finally text/javascript have solved my problem, But yes if you know the Difference between text/javascript and application/javascript then please share to all by commenting here. Also you can explain the case in which can we can use particular. Looking forward for your response.

 

 

Shares:
  • Thomas Schmidt
    June 10, 2011 at 1:59 pm

    The difference is simple: application/javascript is the correct mime type while text/javascript never existed officially.

    Microsoft know that and shits on it. Do you really want to write defective code to make some stupid “developers” happy? I have enough visitors without that crap.

    Reply
  • Hossein Baghayi
    January 22, 2012 at 8:34 pm

    Hi,
    The both codes are the same, even the value of the type attribute,
    Have a look at it, please :)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *