现在的位置: 首页 > 综合 > 正文

flash判断当前使用的浏览器类型

2012年08月30日 ⁄ 综合 ⁄ 共 740字 ⁄ 字号 评论关闭
var bType:String = "浏览器ua信息:";
bType +=  ExternalInterface.call("eval","navigator.userAgent");
bType = bType.toLowerCase();
txt.htmlText = bType;

txt.htmlText +="<br />您使用的是:"

if (bType.indexOf("msie") != -1)
{
    if (bType.indexOf("se 2.x") != -1)
    {
        txt.htmlText +=  "搜狗浏览器";
    }
    else
    {
        txt.htmlText +=  "IE内核非搜狗浏览器";
    }
}
if (bType.indexOf("firefox") != -1)
{
    txt.htmlText +=  "firefox浏览器";
}
if (bType.indexOf("chrome") != -1)
{
    txt.htmlText +=  "firefox浏览器";
}
if (bType.indexOf("opera") != -1)
{
    txt.htmlText +=  "firefox浏览器";
}
if (bType.indexOf("safari") != -1)
{
    txt.htmlText +=  "safari浏览器";
}

 

记得允许脚本执行

 

<param name="allowScriptAccess" value="sameDomain" />跨域加载的swf,需要value的值为always

 

/Files/xxcainiao/browserInfo.rar 

抱歉!评论已关闭.