Groups | Blog | Home
all groups > flash (macromedia) > june 2005 >

flash (macromedia) : Browser detection


ChrisFlynn
6/22/2005 11:49:13 PM
Hi all

I'm trying to find a way that Flash can detect what kind of browser its in.

So if my swf is in IE on the Mac, through actionscript, can Flash tell me what
browser its in.

I'd figure that this could be done with the System.capabilities object, but no
such luck.

And I can't seem to find a way of reading the user agent or headerValue or
anything.

If anyone knows how to do this, I'd appreciate some advice.

Thanks
Chris
ChrisFlynn
6/23/2005 12:00:00 AM
Actually Ive tried the System.capabilities.playerType route. In IE on Macs, "PlugIn" is returned, not "ActiveX", so you're method doesnt work (at least it didnt for me).

Thanks
NSurveyor
6/23/2005 1:07:17 AM
Unfortunately there is no way of detecting browser. However you can see what
type of player the Flash content is being run on: System.capabilities.playerType

It can be:

"StandAlone" for the Flash StandAlone Player
"External" for the Flash Player version used by test movie mode,
"PlugIn" for the Flash Player browser plug-in
"ActiveX" for the Flash Player ActiveX Control used by Microsoft Internet
Explorer

Notice the last one. Its only for Microsoft Internet Explorer. So, I guess if
you checked to see if the playerType is "ActiveX", it would do the same thing
as checking for Internet Explorer.

if(System.capabilities.playerType=="ActiveX"){
trace("You're using MSIE!");
}

I noticed you mentioned MSIE on Mac. If you wanted to test for that, just add
another condition to check the os:

if((System.capabilities.playerType=="ActiveX") &&
(System.capabilities.os=="MacOS")){
trace("You're using MSIE on a Mac!");
}
AddThis Social Bookmark Button