Skip to content

Instantly share code, notes, and snippets.

@digitarald
Created September 14, 2012 00:11
Show Gist options
  • Select an option

  • Save digitarald/3718837 to your computer and use it in GitHub Desktop.

Select an option

Save digitarald/3718837 to your computer and use it in GitHub Desktop.
Bookmarklet mozApps.install and launch - Reads manifest from text selection or current URL
javascript:(function(a,b){if(/\/$/.test(b))b+="manifest.webapp";var c=a.install(b);c.onsuccess=c.onerror=function(){if(c.error)alert(b+"/n"+c.error.name);else c.result.launch()}})(navigator.mozApps,(getSelection().toString()||location.href).trim());
(function (apps, url) {
if ((/\/$/).test(url)) url += "manifest.webapp";
var ret = apps.install(url);
ret.onsuccess = ret.onerror = function () {
if (ret.error) alert(url + '/n' + ret.error.name)
else ret.result.launch();
};
})(navigator.mozApps, (getSelection().toString() || location.href).trim());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment