Validation within Javascript for framework existence

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using JavaScript, is there a way to identify if the user machine has .NET 2.0
frame installed?
 
PP said:
Using JavaScript, is there a way to identify if the user machine has .NET 2.0
frame installed?

The user agent string of Internet Explorer is changed to contain e.g.
.NET CLR 2.0.50727
so with script inside of IE you could parse
navigator.userAgent
to look for that substring to check whether the .NET framework runtime
is installed:

function checkNETFramework (version) {
var pattern = new RegExp('.NET CLR ' + version);
return pattern.test(navigator.userAgent);
}

if (checkNETFramework('2.0')) { ... }

But don't expect other browsers to expose the MS .NET framework version
in the user agent string.


And there is no need to depend on client-side script to check the user
agent string, it is usually sent as a HTTP request header and that is
exposed server side in ASP.NET e.g. you could check
Request.UserAgent.IndexOf(".NET CLR " + "2.0") > -1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top