beefproject/beef-migration-test — Issue #137: 200 - add google gears detection  
Author: beefproject
Created: 2011-12-03 02:12:07+00:00
State: open

see here for inspiration:

http://code.google.com/apis/gears/gears_init.js &&
http://code.google.com/apis/gears/tools.html

(function() {
// We are already defined. Hooray!
if (window.google && google.gears) {
return;
}

var factory = null;

// Firefox
if (typeof GearsFactory != 'undefined') {
factory = new GearsFactory();
} else {
// IE
try {
factory = new ActiveXObject('Gears.Factory');
// privateSetGlobalObject is only required and supported on IE Mobile
on
// WinCE.
if (factory.getBuildInfo().indexOf('ie_mobile') != -1) {
factory.privateSetGlobalObject(this);
}
} catch (e) {
// Safari
if ((typeof navigator.mimeTypes != 'undefined')
&& navigator.mimeTypes["application/x-googlegears"]) {
factory = document.createElement("object");
factory.style.display = "none";
factory.width = 0;
factory.height = 0;
factory.type = "application/x-googlegears";
document.documentElement.appendChild(factory);
if(factory && (typeof factory.create == 'undefined')) {
// If NP_Initialize() returns an error, factory will still be
created.
// We need to make sure this case doesn't cause Gears to appear to
// have been initialized.
factory = null;
}
}
}
}
...
}

Original link: http://code.google.com/p/beef/issues/detail?id=200