SWF对象库是否可以在所有浏览器中使用? [英] SWF Object library will work in all the browsers?

查看:69
本文介绍了SWF对象库是否可以在所有浏览器中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

            if (typeof t.plugins != D && typeof t.plugins[S] == r) {
                ab = t.plugins[S].description;
                if (ab && !(typeof t.mimeTypes != D && t.mimeTypes[q] && !t.mimeTypes[q].enabledPlugin)) {
                    T = true;
                    X = false;
                    ab = ab.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
                    ag[0] = parseInt(ab.replace(/^(.*)\..*$/, "$1"), 10);
                    ag[1] = parseInt(ab.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
                    ag[2] = /[a-zA-Z]/.test(ab) ? parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0
                }
            } else {
                if (typeof O.ActiveXObject != D) {
                    try {
                        var ad = new ActiveXObject(W);
                        if (ad) {
                            ab = ad.GetVariable("$version");
                            if (ab) {
                                X = true;
                                ab = ab.split(" ")[1].split(",");
                                ag = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)]
                            }
                        }
                    } catch (Z) {}
                }
            }
            return {
                w3: aa,
                pv: ag,
                wk: af,
                ie: X,
                win: ae,
                mac: ac
            }
        }()

上面的代码在swf对象库中使用.它们检查用jquery编写的插件和ActiveX对象.Activex仅可在IE中使用.我怀疑是否可以在所有浏览器中使用?如何运作?

The above code used in swf object library .They checking plugin and ActiveX object written in jquery.Activex will work in IE only.My doubt is whether it will work in all the browsers?if it is yes means ,how its working?

推荐答案

为什么不起作用?对ActiveX的检查是有条件的,并且在出现错误的情况下也可以访问对ActiveX对象的访问.

Why shouldn't it work? The check for ActiveX is conditional as well as the access to the ActiveX object catched in case of an error.

因此,任何不支持非IE行为的浏览器(即,除IE之外的所有浏览器),都将由else处理.

So any browser that does not support non-IE behavior (that is, all except IE ;)), will be handled by the else.

顺便说一句:回购中的最新版本的代码结构有所不同

BTW: the latest version in the repos has the code a little differently structrued

.... }
else if (typeof win.ActiveXObject != UNDEF) {
   try {
       var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
       if (a) { // a will return null when ActiveX is disabled
          d = a.GetVariable("$version");
          if (d) {
             ie = true; // cascaded feature detection for Internet Explorer
             d = d.split(" ")[1].split(",");
             playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
            }
        }

   catch(e) {}
}

它不再是else而是else if(再次尝试捕获).最常见的情况是事前准备.他们只是检查navigator.plugins报告的浏览器加载的所有插件.由于这是这样做的方法,因此大多数浏览器永远不会进入else if部分.

It's not an else anymore but an else if (again with a try-catch). The most common case is coverd before hand. They simply check for all the plugins loaded by the browser as reported by navigator.plugins. Since this is the way to do it, most browsers will never enter the else if part.

要获取有关navigator.plugins的某些信息,请检查 MDN文档.这是一个浏览器,可以在所有浏览器中使用(通常的IE除外,但是上面代码中的技术会解决这个问题).这将始终是插件".如果您尝试以其他方式访问它,例如插件",由于未定义,因此会出现错误.

To get some information about navigator.plugins, check the MDN docs. This is a browser thing and available in all browsers (except the usual IEs, but the technique from the code above will take care of this). This will always be "plugins". If you try to access it differently e.g. "plugin", you will get an error since it is not defined.

我不太清楚提到jQuery的意思.这是香草JS,因此没有使用jQuery.我们经常使用这个库,我可以向您保证,它稳定且经过了良好的测试.

I'm not quite sure what you mean by mentioning jQuery. This is vanilla JS, so there is no jQuery used. We used this library quite often and I can asure you, it is stable and well tested.

这篇关于SWF对象库是否可以在所有浏览器中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆