惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - Boy Xie

sql xpath 收藏 HTTP 错误 sql2008 备份 javascript小收藏 转载 收藏sharepoint修改该服务器机器名 5月12日 日志 2010年5月11日日志 公司居然使用监听设备,大家来讨论下IT公司应该怎样管理 历史人物谈股市 常考的js笔试语句 - Boy Xie - 博客园 C# 读取excel - Boy Xie dns服务器列表 EXTJS 双层表头 记录 常用js收藏 页面宽度 SQL中取得时间的一些技巧 loadfrom 与 loadfile 区别 使用深度V8.1 系统后打开部分文件夹缓慢 ascII 表 收藏
判断客户端是否安装framework
Boy Xie · 2008-06-16 · via 博客园 - Boy Xie

安装 .NET Framework 3.5 后,MSI 会将“.NET CLR”和版本号添加到 UserAgent 字符串中。下面的示例演示一个嵌入到简单的 HTML 页的脚本。该脚本搜索 UserAgent 字符串以确定是否已安装 .NET Framework 3.5,并在搜索结果中显示状态消息。

<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 Framework 3.5 时,客户端计算机配置了用于 Firefox 2.0+ 的插件,该插件使 Firefox 2.0+ 可以承载 XAML 浏览器应用程序 (XBAP)。下面的示例脚本在检查“Windows Presentation Foundation”插件之前,会检查脚本是否由 Firefox 2.0+ 承载。无论结果如何,该脚本都会显示相应的状态消息。

<HTML>

  
<HEAD>
    
<TITLE>Test for the Firefox Plugin for WPF</TITLE>
    
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
    
<SCRIPT type="text/javascript">
    
<!--
    
function OnLoad()
    
{
       
// Check if browser is Firefox
       if( navigator.plugins.length == 0 ) {
         document.writeln(
"The browser must be Firefox 2.0+.");
         
return;
       }


       
// Check for WPF plugin and report
       var msg = "Windows Presentation Foundation Plugin for Mozilla Firefox is ";
       
var wpfPlugin = navigator.plugins["Windows Presentation Foundation"];
       
if( wpfPlugin != null ) {
          document.writeln(msg 
+ " installed.");
       }

       
else {
          document.writeln(msg 
+ " not installed. Please install or reinstall the .NET Framework 3.5.");
       }

    }

    
-->
    
</SCRIPT>
  
</HEAD>
  
  
<BODY onload="OnLoad()" />

</HTML>