• 检测flash 版本


    var nav = navigator;
    
    var module =  {
        Plugins: {
                list: function() {
                    var list = [];
                    if (nav.plugins) {
                        for (var i = 0, l = nav.plugins.length; i < l; i++)
                        {
                            var plugin = {};
    
                            if (nav.plugins[i].name) {
                                plugin.name = nav.plugins[i].name;
                            }
    
                            if (nav.plugins[i].description) {
                                plugin.description = nav.plugins[i].description;
                            }
    
                            list[list.length] = plugin;
                        }                    
                    }
    
                    return list;
                },
                get: function (name) {
                    for (var i = 0, l = nav.plugins.length; i < l; i++)
                    {
                        if (nav.plugins[i].name === name) {
                            return nav.plugins[i];
                        }
                    }
                    return undefined;
                },
                
                Flash: {
                    version: function () {
                        var vers   = 0;
                        var plugin = module.Plugins.get("Shockwave Flash");
                        
                        if (plugin !== undefined) {                        
                            vers = parseFloat(plugin.description.match(/d{1,2}/));
                        } else {
                            // Test IE
                            var minVersion = 9;
                            var maxVersion = 12;                        
                            for (var i = maxVersion; i >= minVersion; i--)
                            {
                                try
                                {
                                    var test = new win.ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
                                    return i;
                                }
                                catch (e) { /* nothing to see here*/ }
                            }                        
                        }
    
                        return vers;
                    }
                },
                
                Silverlight: {           
                    version: function () {
                        var vers   = 0;
                        var plugin = module.Plugins.get("Silverlight Plug-In");
                        
                        if (plugin !== undefined) {
                            vers = parseFloat(plugin.description.match(/d{1,2}/));
                        } else {
                            // Test IE
                            try {
                                var control = new win.ActiveXObject('AgControl.AgControl');
                                if (control) {
                                    var minVersion = 3;
                                    var maxVersion = 6;
                                    for (var i = minVersion; i <= maxVersion; i++)
                                    {
                                        if (control.isVersionSupported(i + ".0")) {
                                            vers = i;
                                        }
                                    }
                                }
                            } catch (e) { /* nothing to see here*/ }
                        }
    
                        return vers;
                    }
                }
            }
        };
    
    console.log(module.Plugins.Flash.version());
    alert(module.Plugins.Flash.version());
    

     http://www.pinlady.net/PluginDetect/guide/

  • 相关阅读:
    REHの个人主页
    多项式基础学习笔记(2)
    多项式基础学习笔记(1)
    FFT & NTT 学习笔记
    LCT学习笔记
    莫队学习笔记
    SAM 学习笔记
    网络流学习笔记
    关于魔术球贪心做法的证明
    【题解】异或粽子&加强版
  • 原文地址:https://www.cnblogs.com/happy-Chen/p/3645557.html
Copyright © 2020-2023  润新知