此脚本是为 Internet Explorer 设计的。    其他浏览器可能在 UserAgent 字符串中不包含 .NET CLR 信息。

<HTML>
<HEAD>
<TITLE>Test for the .NET Framework 3.5</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
<SCRIPT LANGUAGE="JavaScript">
<!--
var dotNETRuntimeVersion = "3.5.0.0"; function window::onload()
{
if (HasRuntimeVersion(dotNETRuntimeVersion))
{
result.innerText =
"This machine has the correct version of the .NET Framework 3.5."
}
else
{
result.innerText =
"This machine does not have the correct version of the .NET Framework 3.5." +
" The required version is v" + dotNETRuntimeVersion + ".";
}
result.innerText += "\n\nThis machine's userAgent string is: " +
navigator.userAgent + ".";
} //
// Retrieve the version from the user agent string and
// compare with the specified version.
//
function HasRuntimeVersion(versionToCheck)
{
var userAgentString =
navigator.userAgent.match(/.NET CLR [0-9.]+/g); if (userAgentString != null)
{
var i; for (i = 0; i < userAgentString.length; ++i)
{
if (CompareVersions(GetVersion(versionToCheck),
GetVersion(userAgentString[i])) <= 0)
return true;
}
} return false;
} //
// Extract the numeric part of the version string.
//
function GetVersion(versionString)
{
var numericString =
versionString.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i);
return numericString.slice(1);
} //
// Compare the 2 version strings by converting them to numeric format.
//
function CompareVersions(version1, version2)
{
for (i = 0; i < version1.length; ++i)
{
var number1 = new Number(version1[i]);
var number2 = new Number(version2[i]); if (number1 < number2)
return -1; if (number1 > number2)
return 1;
} return 0;
} -->
</SCRIPT>
</HEAD> <BODY>
<div id="result" />
</BODY>
</HTML>

如果搜索“.NET CLR”版本成功,将显示以下类型的状态消息:

This machine has the correct version of the .NET Framework 3.5.

This machine's userAgent string is: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.0.590; .NET CLR 3.5.20726; MS-RTC LM 8).

否则,显示以下类型的状态消息:

This machine does not have the correct version of the .NET Framework 3.5.  The required version is v3.5.0.0.

This machine's userAgent string is: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.0.590; MS-RTC LM 8).

转自:http://technet.microsoft.com/zh-cn/bb909885(v=vs.85).aspx

检测是否安装了 .NET Framework 3.5的更多相关文章

  1. Inno Setup 检测已安装的.NET Framework 版本

    翻译自:http://kynosarges.org/DotNetVersion.html 由 Jordan Russell 写的 Inno Setup 是一个伟大的安装脚本程序,但缺乏一个内置的函数来 ...

  2. 检测电脑安装的net framework版本

    https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx To find .NET Framework versions by ...

  3. InnoSetup自动检测并安装.Net Framework

    InnoSetup可在在脚本中插入[Code]代码段,其中的代码可以通过事件驱动,支持的主要事件如下: function InitializeSetup(): Boolean; ——安装程序初始化,返 ...

  4. .NET/C# 检测电脑上安装的 .NET Framework 的版本

    原文:.NET/C# 检测电脑上安装的 .NET Framework 的版本 如果你希望知道某台计算机上安装了哪些版本的 .NET Framework,那么正好本文可以帮助你解决问题. 本文内容 如何 ...

  5. Windows查看电脑上安装的.Net Framework版本的五种方法(转)

    1.查看安装文件判断Framwork版本号 打开资源管理器,比如我的电脑,再地址栏输入%systemroot%\Microsoft.NET\Framework后单击“转到”或者按回车. 在新文件夹中查 ...

  6. 如何:确定已安装的 .NET Framework 版本

    用户可在他们的计算机上安装和运行 .NET Framework 的多个版本. 当你开发或部署应用时,你可能需要知道用户的计算机上安装了哪些 .NET Framework 版本. .NET Framew ...

  7. 利用私有的库MobileCoreServices检测正在安装的应用

    利用的私有库检测正在安装的app 分为两步:第一,通过placeholderApplications获得所有的正在安装的app的信息 第二,遍历正在安装的app的信息,根据名称获得你想检测的app是否 ...

  8. Windows 8 下离线安装。net Framework 3.5

    Windows 8 下安装.net Framework 3.5 1)可以将直接双击ISO (或放入光盘/U盘)(安装文件在F盘) 2)使用管理员权限运行命令行程序 3)dism.exe /online ...

  9. Android检测是否安装了指定应用

    检测是否安装了指定应用的方法如下: private boolean isAvilible( Context context, String packageName ) { final PackageM ...

随机推荐

  1. Windows下的Memcache安装与测试教程

    Windows下的Memcache安装 1.下载memcache for windows. 下载地址:http://splinedancer.com/memcached-win32/,推荐下载bina ...

  2. JSP中脚本、声明和表达式的本质区别

     JSP脚本元素 使用JSP脚本元素可以将Java代码嵌入到JSP页面里,这些Java代码将出现在由当前JSP页面生成的Servlet中,使JSP将静态内容与动态内容分离出来.脚本元素包含:  1. ...

  3. Android支付接入(一):支付宝

    原地址:http://blog.csdn.net/simdanfeg/article/details/9011603 转载之前我想深深地感谢屌丝哥 相信相同过App获取利润的都会需要接入计费SDK,下 ...

  4. HDU1412

    大水题.. 求集合的并 /* */ #include<algorithm> #include<iostream> #include<string.h> #inclu ...

  5. hdu 3927 Math Geek

    纯数论题,不解释!!!! 代码如下: #include<stdio.h> int main(){ ,m; scanf("%d",&t); while(t--){ ...

  6. UR #13 Ernd

    考试的时候没有注意到可以将(a,b)放在二维平面上之后旋转坐标系,使得转移变成树状数组二维偏序 这样就算我想出来了第二个转移的斜率优化也没有什么卵用啊(摔西瓜 设g(i)表示当前站在第i个水果下面且第 ...

  7. Oracle 列顺序测试

    列顺序测试 大家在做表设计的时候通常对表中列的排列顺序没有过多注意,但是其实越常用的列,它的位置越靠前,则查询速度越快. 因为每个block里面存储了row directory (每行数据在块中的位移 ...

  8. Extension Method[下篇]

    四.Extension Method的本质 通过上面一节的介绍,我们知道了在C#中如何去定义一个Extension Method:它是定义在一个Static class中的.第一个Parameter标 ...

  9. Anti-pattern(反面模式)

    转自维基百科 http://zh.wikipedia.org/wiki/%E5%8F%8D%E9%9D%A2%E6%A8%A1%E5%BC%8F 在软件工程中,一个反面模式(anti-pattern或 ...

  10. bzoj4008

    好题,这题可以分开算每个技能的贡献 orz popoqqq http://blog.csdn.net/popoqqq/article/details/45365759 ..,..] of double ...