<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a homepage where I instanciate a .Net 2.0 component in an object
> tag, but before instanciating the component, I would like to to check
> first if the machine has the .Net 2.0 framework installed.
>
> Anyone who knows how/if I can do this in javascript?
<SCRIPT LANGUAGE="JavaScript">
<!--
CLRVersion = "1.1.4322";
function window:

nload()
{
dnltxt="\n <a
href=\"http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-
bf8203e74006/dotnetfx.exe\">Download .Net Framework</a>";
if(HasRuntimeVersion(CLRVersion))
{
result.innerText = "You have correct version of CLR: " + CLRVersion;
}
else
{
result.innerText = "You don't have correct version of CLR: " + CLRVersion
+ "Please install it first!";
}
}
function HasRuntimeVersion(v)
{
var va = GetVersion(v);
var i;
var a = navigator.userAgent.match(/\.NET CLR [0-9.]+/g);
if(a != null)
{
for(i = 0; i < a.length; ++i)
{
if(CompareVersions(va, GetVersion(a[i])) <= 0)
{
return true;
}
}
}
return false;
}
function GetVersion(v)
{
var a = v.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i);
return a.slice(1);
}
function CompareVersions(v1, v2)
{
for(i = 0; i < v1.length; ++i)
{
var n1 = new Number(v1[i]);
var n2 = new Number(v2[i]);
if(n1 < n2)
{
return -1;
}
if(n1 > n2)
{
return 1;
}
}
return 0;
}
-->
</SCRIPT>