Created
November 7, 2013 22:40
-
-
Save sherbondy/7363116 to your computer and use it in GitHub Desktop.
Woah, one-click chrome extension installation, found while browsing the one-tab website... Didn't know this existed, but makes complete sense.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clickTargetIds = ['installButton1', 'installButton2']; | |
var isChrome = navigator.userAgent.indexOf("Chrome")!=-1; | |
for(var i in clickTargetIds) { | |
document.getElementById(clickTargetIds[i]).onclick = function() { | |
if(isChrome) { | |
window['chrome']['webstore']['install'](undefined, function() { | |
// damn, they even record analytics events to see how effective the install button is... | |
recordGoogleAnalyticsEvent('General', 'install'); | |
}, function(errorString) { | |
recordGoogleAnalyticsEvent('General', 'installFailed', errorString); | |
alert('Installation failed. This could be due to cancelling the dialog box or because you already have the extension installed. If you are running an old version of Google Chrome you may need to update your browser (ideally to Chrome version 25 or above)'); | |
}); | |
} | |
else { | |
alert('OneTab is currently available only for Google Chrome. The mobile and tablet version of Google Chrome does not yet support extensions. A Firefox extension is coming soon.'); | |
} | |
}; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment