Skip to content

Instantly share code, notes, and snippets.

@lmmx
Last active August 29, 2015 13:57
Show Gist options
  • Save lmmx/9811636 to your computer and use it in GitHub Desktop.
Save lmmx/9811636 to your computer and use it in GitHub Desktop.
// via http://snipplr.com/view/6239/
var plugins = {
hasAcrobat:function() {
if (!window.ActiveXObject) return false;
try { if (new ActiveXObject('AcroPDF.PDF')) return true;}
catch (e) {}
try { if (new ActiveXObject('PDF.PdfCtrl')) return true;}
catch (e) {}
return false;
},
hasFlash: function() {
if (!window.ActiveXObject) return false;
try {if (new ActiveXObject('ShockwaveFlash.ShockwaveFlash')) return true;}
catch (e) { return false;}
},
hasJava: function() {
return (!navigator.javaEnabled());
},
hasQuickTime: function() {
if (!window.ActiveXObject) return false;
try { if (new ActiveXObject('QuickTime.QuickTime')) return true;}
catch (e) {}
try {if(new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck')) return true;}
catch (e) {};
return false;
},
hasRealPlayer: function() {
if (!window.ActiveXObject) return false;
var definedControls = [
'rmocx.RealPlayer G2 Control',
'rmocx.RealPlayer G2 Control.1',
'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',
'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',
'RealPlayer'
];
for (var i = 0; i < definedControls.length; i++) {
try {if(new ActiveXObject(definedControls[i])) return true;}
catch (e) {continue;}
}
return false;
},
hasShockwave: function() {
if (!window.ActiveXObject) return false;
try {if(new ActiveXObject(’SWCtl.SWCtl’)) return true;}
catch (e) {return false;}
},
hasWMP: function() {
if (!window.ActiveXObject) return false;
try {if(new ActiveXObject(’WMPlayer.OCX’)) return true;}
catch (e) { return false;}
}
}
function noQTfallback() {
/*
var vid1 = document.getElementById("id13");
var vid1gif = document.createElement('img');
vid1gif.setAttribute("src","http://i.minus.com/iLq6tYSko3c4A.gif");
vid1gif.setAttribute("style",vid1.getAttribute("style"));
document.getElementById("body_layer").replaceChild(vid1gif, vid1);
var vid2 = document.getElementById("id12");
var vid2gif = document.createElement('img');
vid2gif.setAttribute("src","http://i.minus.com/ibyZTHSYnZ5nCs.gif");
vid2gif.setAttribute("style","height: 230px; left: 662px; position: absolute; top: 698px; z-index: 1;");
document.getElementById("body_layer").replaceChild(vid2gif, vid2);
*/
}
function IEhasQT() {
if (!window.ActiveXObject) return false;
try { if(new ActiveXObject("QuickTime.QuickTime")) return true; }
catch (e) {}
try { if (new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck')) return true; }
catch (e) {}
return false;
}
function checkQT() {
var p = navigator.plugins;
var QT = false; // assume you don't have it
for (i=0;i<p.length;i++) {
for (j=0;j<p[i].length;j++) {
if (p[i][j].type == "video/quicktime") {
QT = true;
return true;
}
else continue;
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment