javascript - ASP.NET 使用哪个版本的 Javascript?

标签 javascript asp.net

我正在 Visual Studio 2013 Update 4 中创建 ASP.NET 网站。如何判断 .aspx 文件中使用的是哪个版本的 Javascript?它取决于解释文件的浏览器吗?

对于具有如此多版本和实现的语言,很难得到关于哪些版本/功能受支持的明确答案。

最佳答案

ASP.NET 不包含 Javascript 引擎,因此我不确定说它支持特定版本的 Javascript 是否准确。然而,some ASP.NET web controls 发出 Javascript。

ASP.NET 框架检查浏览器的 user agent header并将其与 browser definition file 中的正则表达式进行匹配。如果您的文件设置正确,您可以通过检查 JScriptVersion Capability 来确定浏览器支持的 Javascript 版本。 。

但是,ASP.NET Web 控件的粒度并不细到要看具体版本;他们只是将浏览器分为两组:UpLevel 和 DownLevel。如果浏览器处于下层,则根本不会生成任何脚本。如果浏览器是高级的,则生成的脚本相当通用:

The client script that ASP.NET generates automatically to support page or control functionality is compatible with all browsers that support ECMAScript (JScript or JavaScript) — that is, it does not depend on the advanced scripting capabilities of dynamic HTML (DHTML). An exception is the Web Parts control set. Web Parts controls require Microsoft Internet Explorer version 5.5 or a later version in order to implement the full capabilities of the controls. Some validation features can take advantage of DHTML if it is available in the browser, but DHMTL is not required. - MSDN

另请参阅ASP.NET web controls and browser capabilities

关于javascript - ASP.NET 使用哪个版本的 Javascript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39276642/

相关文章:

c# - 在同一时间发送短信

javascript - 无法使用 JQuery 获取 asp.net 元素 Text 属性

jquery - 如何将 System.Data.DataTable 传递到 JQuery 文件

javascript - 如何在TextBox中创建图案?

javascript - 当我移动 div 时,JavaScript 内的 Nettuts 不起作用

c# - 如何本地化 DataTable 列名称

c# - 服务器因 ASP.NET-Page (C#) 而崩溃

javascript - 如何禁用网格中的元素

javascript - 如何返回axios外的变量?

javascript - 如何在 Knockout 中从另一个 View 模型更新 View 模型数据