function isUploadControlSetup() { var setup = false; if (window.ActiveXObject) {//ie try { if (new ActiveXObject("Cxdndctrl.Upload")) { setup = true; } } catch (ex) { try { if (new ActiveXObject("ExCxdndCtrl.ExUpload")) { setup = true; } } catch (e) { console.log(ex); console.log(‘创建ActiveXObject("Cxdndctrl.Upload")及ActiveXObject("ExCxdndCtrl.ExUpload")对象失败!‘); } } } else if (navigator.plugins) {//firefox chrome var mimetype = navigator.mimeTypes["application/x-richinfo-cxdnd3"]; setup = (mimetype && mimetype.enabledPlugin) ? true : false; } return setup; }
function isSupportHtml5Upload() { if (window.File && window.FileList && window.FileReader && window.Blob && window.FormData && window.Worker && "withCredentials" in (new XMLHttpRequest)) { return true; } return false; }
function getVersionInIE() { var version = 0; var axo; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn‘t in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) { } if (!version) { try { // version will be set for 6.X players only axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); // installed player is some revision of 6.0 // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, // so we have to be careful. // default to the first public version version = "WIN 6,0,21,0"; // throws if AllowScripAccess does not exist (introduced in 6.0r47) axo.AllowScriptAccess = "always"; // safe to call for 6.0r47 or greater version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 4.X or 5.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 3.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0"; } catch (e) { } } if (!version) { try { // version will be set for 2.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); version = "WIN 2,0,0,11"; } catch (e) { } } if (version !== 0) { var match = version.match(/(\d+),(\d+).*$/); if (match[0]) { version = Number(match[1] + "." + match[2]); } else { version = 0; } } return version; } function getVersionInOthers() { var v = 0; if (navigator.plugins && navigator.plugins.length > 0 && navigator.plugins["Shockwave Flash"]) { var plugins = navigator.plugins["Shockwave Flash"]; for (var i = 0; i < plugins.length; i++) { var swf = plugins[i]; if (swf.enabledPlugin && (swf.suffixes.indexOf("swf") != -1) && navigator.mimeTypes["application/x-shockwave-flash"]) { var match = plugins.description.match(/ (\d+(?:\.\d+)?)/); if (match) { var v = parseInt(match[1]); break; } } } } return v; }
原文:http://www.cnblogs.com/hellohuman/p/3916086.html