Skip to content

Instantly share code, notes, and snippets.

@satyr
Created July 29, 2010 13:05
Show Gist options
  • Save satyr/498059 to your computer and use it in GitHub Desktop.
Save satyr/498059 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: 'test favicon',
preview: function(pb){
const FS = (Cc['@mozilla.org/browser/favicon-service;1']
.getService(Ci.nsIFaviconService));
var uri = Utils.uri(CmdUtils.document.URL);
try { var faviconUri = FS.getFaviconForPage(uri) } catch([]) {}
var dataUrl = faviconUri && FS.getFaviconDataAsDataURL(faviconUri);
pb.innerHTML = <><img src={dataUrl}/><br/>{dataUrl}</>;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment