インストールされているかどうかを検出します.NET Frame ebook 3.5のjsスクリプトです.

3326 ワード

このテーマはHTML/JavaScriptで作成されたスクリプトを提供します.管理者はこのスクリプトを使ってシステム上の存在を確認できます.NET Framwork 3.5.


Test for the .NET Framework 3.5

<br><!-- <br>var dotNETRuntimeVersion = "3.5.0.0"; <br> <br>function window::onload() <br>{ <br>if (HasRuntimeVersion(dotNETRuntimeVersion)) <br>{ <br>result.innerText = <br>"This machine has the correct version of the .NET Framework 3.5." <br>} <br>else <br>{ <br>result.innerText = <br>"This machine does not have the correct version of the .NET Framework 3.5." + <br>" The required version is v" + dotNETRuntimeVersion + "."; <br>} <br>result.innerText += "

This machine's userAgent string is: " + <br>navigator.userAgent + "."; <br>} <br> <br>// <br>// Retrieve the version from the user agent string and <br>// compare with the specified version. <br>// <br>function HasRuntimeVersion(versionToCheck) <br>{ <br>var userAgentString = <br>navigator.userAgent.match(/.NET CLR [0-9.]+/g); <br>if (userAgentString != null) <br>{ <br>var i; <br>for (i = 0; i < userAgentString.length; ++i) <br>{ <br>if (CompareVersions(GetVersion(versionToCheck), <br>GetVersion(userAgentString[i])) <= 0) <br>return true; <br>} <br>} <br>return false; <br>} <br>// <br>// Extract the numeric part of the version string. <br>// <br>function GetVersion(versionString) <br>{ <br>var numericString = <br>versionString.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i); <br>return numericString.slice(1); <br>} <br>// <br>// Compare the 2 version strings by converting them to numeric format. <br>// <br>function CompareVersions(version1, version2) <br>{ <br>for (i = 0; i < version1.length; ++i) <br>{ <br>var number1 = new Number(version1[i]); <br>var number2 = new Number(version2[i]); <br>if (number1 < number2) <br>return -1; <br>if (number1 > number2) <br>return 1; <br>} <br>return 0; <br>} <br> <br>--> <br>







「.NET CLR」バージョンの検索が成功すると、以下のタイプの状態メッセージが表示される.
This Machine has the corect version of the.NET Frame ebook 3.5.
This machine's userAgent string is:Mozara/4.0(comptible;MSIE 7.0;Windows NT 6.0;SLC 1;NET CLR 2.5.0727;NET CLR 1.1.322;InfoPath.2;NET CLR 3.0.5.50;NET CLR 3.2.7226;MSTC-RM 8.
さもないと、以下のタイプのステータスメッセージが表示されます.
This machine does not have the corect version of the.NET Frame ework 3.5.The required version is v 3.5.
This machine's userAgent string is:Mozara/4.0(comptible;MSIE 7.0;Windows NT 6.0;SLC 1;NET CLR 2.5.0727;NET CLR 1.1.322;InfoPath.2;NET CLR 3.05.90、MS-TC LM 8).