Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home JavaScript
 

JavaScript Type Attribute

 

Building an Ajax based application requires building the application through JavaScript. You might end up using a framework if you are not familiar with JavaScript but the end product is still on JavaScript. Ajax would be almost nothing without JavaScript.


Part of JavaScript is the extensive type that could validate the website. In a regular Ajax based or just a purely JavaScript enabled website, the attribute would easily identify the contents of the website so that it could be admitted by the browser.


However, some confusion is starting to grow today regarding the type. There are quite a couple of type attributes that you could add to your website so that it could be implemented. But just recently, type cannot seem to be accepted in some practices. This is most especially true in Google’s version of coding JavaScript. Google does not just change the attribute but completely removes them. The most common type text/javascript is dropped by Google. There is a pretty logical explanation about this. Since you are already building an Ajax based application intensely building through JavaScript, validation could be easily dropped since most browsers could easily read JavaScript. No need to have a type attribute at all.


The problem though is that certain versions of HTML and XHTML cannot continue without the type. The problem is not actually on the browser but on the coding practice itself. But that does not mean we have to drop attributes, it can still be added easily.


Since type can be added to JavaScript, the concern is now focused on what type of attribute should be added. For as long as I can remember, the type attribute text/javascript has always been there and has been practically used by and JavaScript developer in building an Ajax based website or a JavaScript application. While this looks really effective closer examination about the type will reveal that this attribute is actually an obsolete one. The memo was released by the IETF (Internet Engineering Task Force) last April 2006 explaining that text/javascript cannot provide the necessary security and validation it used to have considering the advancement of today’s internet.


Text/javascript as an obsolete type attribute is even new to me even though it was released almost two years ago. But anyway, the recommended type attribute that could be used in modern Ajax and JavaScript websites and applications is the application/javascript validation. This is just fare since wrapping parts of a website so that information could be streamed individually could be easily regarded to as an “application” and this is even true when JavaScript is used to build RIAs.


All seemed to be very smooth about application/javascript but it has a major problem: the IE. Apparently, the latest version (or any of its previous versions) does not have the ability to read application/javascript type attribute. The previous type attribute could be accepted in IE but this is just new to IE that it cannot read the validation attribute. In the end, you build two separate versions of an application – all because you have to write the type attribute which is almost a dead end.



Read Next: ECMAScript 4 - The Future of JavaScript



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links