问题
I'm making an application with SL/flash charts and am wondering if there is a way to test if the browser it's being pushed to supports silverlight or not (ipad/iphone). And if it doesn't, then I can use some kind of AJAX chart in its place.
If this is possible to interchange platforms by testing against the host, how would I do this?
回答1:
For flash, you can either use this: http://ppk.home.xs4all.nl/js/flash.html or this: http://www.adobe.com/support/flash/how/shock/javaplugs/javaplugs04.html
Silverlight is discussed here: Detect via javascript whether Silverlight is installed
回答2:
You can use little hack here.
Make simple as3 flash movie and make call
try
{
navigateToURL(new URLRequest("javascript:flashCheck()"),"_self");
}
catch (e:Error){}
and after that you can write simple check function in javascript ( flashCheck(){} ).
You know that this function only callable from as3 (swf) so you can determine what you need to.
Hope this helps.
p.s.
and i pretty sure that you can do this trick with you silverlight.
回答3:
We've use this in the past, http://developer.apple.com/internet/webcontent/detectplugins.html
Doesn't do Silverlight.
来源:https://stackoverflow.com/questions/6320562/is-there-a-way-to-test-if-a-browser-supports-flash-silverlight