javascript -
问题描述
<script language="JavaScript1.2" ...
<script language="JavaScript" ...
Would those declarations make the JavaScript execution differ?
解决方案
The language
attribute is obsolete, browsers should only respect the type=""
attribute.
On a historical note, the DOM API was (and ostensibly, still is) designed for many different languages and the W3C didn't endorse JavaScript in particular. Browsers have, at one point, supported:
- JavaScript/ECMAScript
- VBScript (Internet Explorer)
- JScript (Microsoft's extensions to ECMAScript)
- tcl (referenced by the HTML4.01 specification)
- Rexx (IBM WebExplorer on OS/2)
- Python (supported by Mosaic for a brief period)
So the idea was that different browsers were free to support whatever language they wanted, and it might be platform-specific if they executed scripts using some operating-system built-in language instead of it being embedded in the browser's own code-base (like how JScript/VBScript in Internet Explorer came from Windows' Active Scripting feature, it wasn't built-in to IE (until IE9), or tcl
on Unix)
So on Internet Explorer I understand that IE would use the language=""
attribute to look-up other Active Scripting languages if installed - so if you had a third-party script engine installed, like "ActivePerl" or even Fortran then that would also work in a <script>
element in HTML, which is kinda crazy.
To answer your question directly (what possible values are there), the answer is "no-one knows": the attribute was deprecated back in 1998 in the HTML4.01 specification precisely because there was no standardised list of values for the language=""
attribute:
https://www.w3.org/TR/html4/interact/scripts.html#adef-language
language
This attribute specifies the scripting language of the contents of this element. Its value is an identifier for the language, but since these identifiers are not standard, this attribute has been deprecated in favor oftype
.
推荐阅读
- .net-core - 如何在 .NET Core 控制台应用程序中存储环境变量?
- asp.net-core - 如何配置 MassTransit 以便队列中的命令等待消费者?
- r - 使用因素:将两个函数放入 dplyr
- typescript - TypeScript:即使 strictNullChecks 为假,我是否可以检查类型是否包含未定义?
- ruby - 在 /tmp/vagrant-puppet 找不到课程
- sqlite - 颤振 | 行太大而无法放入 CursorWindow
- python - 发送消息时禁用登录 Flask-Mail
- django - 使用 djangosaml2 实现 SSO 时出现验证错误 'is_staff': ["'true' value must be True or False."]
- vba - 在 VBA for Outlook 的另一个子中调用函数
- cypress - 柏树访问未捕获参考