开发者

Attaching xul elements to a webpage (Firefox Addon dev)

I am learning to create addons for Firefox and I have a question about xul. I want to know if it is possible to add xul elements to all any webpage I go on (not the tab/tool/menu开发者_如何学Go bar).

I want to be able to put something like a div (box) on the webpage separate from the dom of the page (because I would like it to appear there even if I change webpages). It is not a popup (I do not want it in its own window) but an element on the page. I know i can load up JavaScript to edit the page (similar to Greasemonkey userscripts) but I would like it to not load up every time I go to a new page.

If you need more information I can provide some more. Thanks in advance.


No, this is not possible. XUL is a language created by Mozilla for creating the application that houses your HTML code:

Mozilla has configurable, downloadable chrome, meaning that the arrangement and even presence or absence of controls in the main window is not hardwired into the application, but loaded from a separate UI description. In fact, most of Mozilla's windows (and dialogs) will be described using this mechanism. XUL (pronounced "zool," as if that spelling helped any, and short for "XML User Interface Language") is our name for the language in which these UI descriptions are built.

Window chrome is displayed and managed by the same layout engine that manages HTML content in the browser. UI descriptions, then, look a great deal like HTML 4. XUL is an application of XML. In fact, it is just XML with specific meaning defined for a few element types, and into which HTML can be scattered.

(source)

It is used to build applications that contain web browsers, and is extensible to allow it to include HTML code in the xul application, but it is not possible to do the opposite, since the HTML language doesn't recognize XUL code.

Simply put, your HTML code is in an HTML browser embedded in the XUL-coded application (firefox). Two different languages, for two different purposes. If you want XUL-like elements in your HTML, you will have to use css to create them, but you can't embed XUL in HTML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜