html - How does the browser knows how to interpret the script tag? -


according this:

http://www.w3.org/tr/1999/rec-html401-19991224/interact/scripts.html

the type of script added in script tag. values are: "text/tcl", "text/javascript", "text/vbscript".

recently i've seen in page: cofeescript in 1,2,3 following:

  <script src="coffee-script.js"></script>  <script type="text/coffeescript">          alert "hello coffeescript!"  </script> 

and works great! ( had download cofeescript library , use 1 in folder )

my question is. how browser knows given script should handled? have no idea.

seeing can't finish answer, it's not yet entirely clear question ;)

but answer question related: the type attribute of script , style elements in html?

summary:

  • type indeed required attribute in html 4

  • it defaults text/javascript in html 5

as far know, text/javascript de facto default in modern browsers if property missing in html 4.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -