Tom
Tom

Reputation: 6707

How to detect in flash module is running inside google chrome?

Is there a was for Flash module to know its running inside Chrome?

I prefer a solution without any javascript on web page itself.

Upvotes: 2

Views: 121

Answers (1)

Tom
Tom

Reputation: 6707

private function getUserAgent():String

        {

            try

            {

                userAgent = ExternalInterface.call("window.navigator.userAgent.toString");

                var browser:String = "[Unknown Browser]";



                if (userAgent.indexOf("Safari") != -1)

                {

                    browser = "Safari";

                }

                if (userAgent.indexOf("Firefox") != -1)

                {

                    browser = "Firefox";

                }

                if (userAgent.indexOf("Chrome") != -1)

                {

                    browser = "Chrome";

                }

                if (userAgent.indexOf("MSIE") != -1)

                {

                    browser = "Internet Explorer";

                }

                if (userAgent.indexOf("Opera") != -1)

                {

                    browser = "Opera";

                }

            }

            catch (e:Error)

            {

                //could not access ExternalInterface in containing page

                return "[No ExternalInterface]";

            }



            return browser;

        }

Upvotes: 3

Related Questions