/    Sign up×
Community /Pin to ProfileBookmark

<script> language

I saw a section of the javascript like this:

<script>

//Some javascripts here

</script>

My questions are:

1)The language is not specified in the <script> tag. How can the browser know it is a javascript not a VB script?

2)If the language is not specified in the <script> tag, will the browser assume the defualt langauge is the javascript?

Thanks

Scott

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisMay 16.2007 — 1)The language is not specified in the <script> tag. How can the browser know it is a javascript not a VB script?[/quote]IE will examine the script and try to decide which language it is. They like lazy coders. ?2)If the language is not specified in the <script> tag, will the browser assume the defualt langauge is the javascript?[/QUOTE]
Never assume. It makes an ASS out of U and ME. :0 That will depend on the browser. For example, I know that Netscape Navigator (<= 4.8) would default to JS 1.1 if there was no language specified, and like I said IE will try to figure it out.

The latest and greatest W3 specification requires&lt;script type="text/[color=red](whateverlanguage)[/color]"&gt;but I don't know if the validator will complain.
Copy linkTweet thisAlerts:
@mrhooMay 16.2007 — Another valid method is to declare the Content-Script-Type in the document head:

<META http-equiv="Content-Script-Type" content="text/javascript">
×

Success!

Help @scottjsn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...