RadControls version |
Tested on 2012 Q2
|
.NET version |
Tested on 4.0
|
Visual Studio version |
2010
|
programming language |
C#
|
browser support |
all browsers supported by RadControls
|
PROJECT DESCRIPTION
If you don't have Silverlight installed, RadAsyncUpload will failover to another upload method.
However, if you
do have Silverlight installed but it is an old version you are presented with the option to upgrade your Silverlight installation, but if you decline then you are stuck. RadAsyncUpload simply refusxes to play. This is a real problem for users whose IT departments refuse to upgrade their version of Silverlight
The following code, based on code taken from
http://www.silverlightversion.com will disable the Silverlight control on your page if the version falls below the minimum required for RadAsyncUpload to work allowing the control to failover to another upload method.
Telerik.Web.UI.RadAsyncUpload.Modules.Silverlight.isAvailable =
function
()
{
//try firefox/non-IE version.
var
nav = navigator.plugins[
"Silverlight Plug-In"
];
var
installedVersion;
if
(nav)
{
for
(
var
i = 0; i < 4; i++)
{
installedVersion = nav.description;
}
}
else
{
//try the IE one now.
try
{
var
control =
new
ActiveXObject(
'AgControl.AgControl'
);
//the following would be faster with a binary search, but this is "fast enough" for now.
var
vers = Array(1, 0, 0, 0);
loopMatch(control, vers, 0, 1);
loopMatch(control, vers, 1, 1);
loopMatch(control, vers, 2, 10000);
loopMatch(control, vers, 2, 1000);
loopMatch(control, vers, 2, 100);
loopMatch(control, vers, 2, 10);
loopMatch(control, vers, 2, 1);
loopMatch(control, vers, 3, 1);
installedVersion = vers[0] +
"."
+ vers[1] +
"."
+ vers[2] +
"."
+ vers[3]
}
catch
(e)
{
return
false
;
}
}
if
(installedVersion ==
null
)
{
return
false
;
}
return
installedVersion >=
"4.0.50826"
;
}
function
loopMatch(control, vers, idx, inc)
{
while
(IsSupported(control, vers))
{
vers[idx] += inc;
}
vers[idx] -= inc;
}
function
IsSupported(control, ver)
{
return
control.isVersionSupported(ver[0] +
"."
+ ver[1] +
"."
+ ver[2] +
"."
+ ver[3]);
}
--
Stuart