I open my Firefox extensio开发者_Python百科n window in a browser's tab. Is it possible to set a favicon for that tab?
The code from the Mozilla site does not work correctly - it produces the following error message: "Warning: XUL box for box element contained an inline link child, forcing all its children to be wrapped in a block". If this code is placed between 'window' tags it messes up all other controls on the window. If it is placed between 'box' tags, window controls are rendered fine, but still there is this error message. The problem was solved by adding the display property and setting it to "none". The working code looks like this:
<window xmlns="mozilla.org/keymaster/gatekeeper/there.is.only.xul";
xmlns:html="w3.org/1999/xhtml">
<!-- Icon from chrome -->
<html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png"
style="display:none"/>
Create this Folder structure inside the chrome folder
\icons\default
if your window id is mainwindow create a file named mainwindow.ico or mainwindow.xpm
You can easily create an icon for a XUL window. By creating files yourwindow.ico or yourwindow.xpm where yourwindow is the ID of your XUL window. And place the files in your directory structure like this : chrome/icons/default This will override the global icon files. More Information about XUL window and icon can be found here : https://developer.mozilla.org/en/XUL/window
精彩评论