difference between "text/javascript" and "JavaScript" - Javascript
This is a discussion on difference between "text/javascript" and "JavaScript" - Javascript ; Hi
I am new to Javascript and am not sure what is the difference between the
following two statements:
<script type="text/javascript">
.....
</script>
and
<SCRIPT LANGUAGE = "JavaScript">
<!--
.....
</SCRIPT>
Can someone elaborate on this? Thanks...
-
difference between "text/javascript" and "JavaScript"
Hi
I am new to Javascript and am not sure what is the difference between the
following two statements:
<script type="text/javascript">
.....
</script>
and
<SCRIPT LANGUAGE = "JavaScript">
<!--
.....
</SCRIPT>
Can someone elaborate on this? Thanks
-
Re: difference between "text/javascript" and "JavaScript"
Navodit said the following on 4/18/2007 12:11 PM:
> Hi
>
> I am new to Javascript and am not sure what is the difference between the
> following two statements:
The first is required by the validator, the second is deprecated by the
validator (although both are deprecated).
> <script type="text/javascript">
> ....
> </script>
>
>
> and
>
>
> <SCRIPT LANGUAGE = "JavaScript">
> <!--
> ....
> </SCRIPT>
>
> Can someone elaborate on this? Thanks
Aside from the validator barfing on that language attribute, there are
some versions of the language attribute (javascript1.2 is the most
prevelant) can cause some unexpected behavior in some browsers.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
-
Re: difference between "text/javascript" and "JavaScript"
On Apr 18, 6:11 pm, "Navodit" <kaush...@uiuc.edu> wrote:
> I am new to Javascript and am not sure what is the difference between the
> following two statements:
> <script type="text/javascript">
> and
> <SCRIPT LANGUAGE = "JavaScript">
> Can someone elaborate on this? Thanks
The language="javascript" is the oldest syntax and is supported
by all browsers, even the newest. The <script part tells the HTML
parser what it's about to receive, and the language parts tells it
that the script is in javascript format.
The type="text/javascript" came along later and was meant to be
the preferred new method of declaring javascript. This relates to
mimetype and instructs the browser that it's plain text and the
language is javascript. I imagine the idea was that you might be
able to have compressed text also e.g., "compressed/javascript"
but that never came into existence. This is just speculation here.
When text/javascript came along they did something that has
been mostly used by the Java community, which is to "deprecate"
the old style language tag.
That means simply that they don't recommend using that in any
new code, and when time permits (or next time you're working on
it) update any old code. There's never been any timetable on
when language="javascript" would no longer be supported, and
as it's used so widely across the internet, nobody wants to break
lots of webpages that sit out there unmodified and will do so for
years to come. So NO NEW browsers have ceased supporting the
language tag and I doubt without any other major sweeping change
in the web occurring, it will become unsupported.
All my code releases continue to use language="javascript" and
will continue to until a new browser comes along that doesn't like it.
I don't see the benefit of changing my code and suddenly alienating
any older browsers that maybe don't know about it. It ain't broke so
I'm not going to try fixing it 
Similar Threads
-
By Application Development in forum TCL
Replies: 1
Last Post: 05-16-2007, 01:50 PM
-
By Application Development in forum JDBC JAVA
Replies: 0
Last Post: 03-21-2007, 01:26 PM
-
By Application Development in forum DOTNET
Replies: 0
Last Post: 03-12-2006, 03:55 AM
-
By Application Development in forum JDBC JAVA
Replies: 5
Last Post: 11-17-2005, 04:54 PM
-
By Application Development in forum Javascript
Replies: 0
Last Post: 04-25-2005, 04:12 AM