codeschmiede.net
This could be especially helpful for shareware vendors, microISVs or freeware tool builders.
This script checks if the navigator.userAgent return string contains "NET CLR".
If that is found it checks for the specific version of the Microsoft dotnet framework.
This provides an easy and fast help for your users.
If the framework is missing, the user can be either directed towards the download sites at Microsoft or led to an installer including the .NET framework.
If the framework is already in place, the visitor enjoys a smaller download.
The script consists of two parts, the Javascript and the embedding HTML.
<script language="javascript">
function dotnet()
{
var ag = navigator.userAgent;
if (ag.indexOf("IE")!=-1)
{
if (ag.indexOf("NET CLR") != -1)
{
if (ag.indexOf("NET CLR 1.0")!= -1)
{
document.write(".net Framework version 1.0 found.<br/>");
}
if (ag.indexOf("NET CLR 1.1")!= -1)
{
document.write(".net Framework Version 1.1 found.<br/>");
}
if (ag.indexOf("NET CLR 2")!= -1)
{
document.write(".net Framework Version 2 found.<br/>");
}
}
else
{
document.write("No .net Framework found.<br/>Please install the .net Framework.");
}
}
else
{
document.write("The automatic detection of the .net framework only works in Internet Explorer.");
}
}
</script>
<div style="background-color: FFCC00; border-width: 1; border-style: solid; border-color: 000000;
width: 800px; padding: 4px; line-height: 14px;">
.net Framework Status
</div>
<div style="border-width: 0px 1px 1px 1px; border-style: solid; border-color: 000000; width: 800px;
padding: 4px;">
<script language="javascript">
dotnet();
</script>
</div>