JamesFaix JamesFaix - 1 year ago 115
ASP.NET (C#) Question

Which version of Javascript does ASP.NET use?

I am creating an ASP.NET web site in Visual Studio 2013 Update 4. How can I tell which version of Javascript is being used in my .aspx files? Does it depend on the browser that is interpreting the files?

For a language with so many versions and implementations, it's very hard to get a clear answer about which versions/features are supported where.

Answer Source

ASP.NET does not contain a Javascript engine, so I am not sure it is accurate to say it supports a particular version of Javascript. However, some ASP.NET web controls do emit Javascript.

The ASP.NET framework inspects the browser's user agent header and matches it to a RegEx in the browser definition file. If your file is set up correctly, you can determine the version of Javascript supported by the browser by inspecting the JScriptVersion Capability.

However, ASP.NET web controls are not so granular as to look at the specific version; they simply divide browsers into two groups, UpLevel and DownLevel. If a browser is downlevel, no script is produced at all. If a browser is uplevel, the script that is produced is fairly generic:

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

See also ASP.NET web controls and browser capabilities

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download