I am writing an extension for firefox which will be used to annotate pages on the web via a service. I would like to have a div or an overlay element (probably XUL based) at the bottom of the page which will let people annotate a page and save it. Something like what the Google Friend Connect does on this page, but via an addon.
This floating div/overlay should show up for every page on FF and should render contents from a web service. How do I start building this out?
If it is possible to access DOM via a FF plugin and alter it, then I would like to be able to add a floating div to the body of the document. But that doesn’t work either. Example posted here: Dynamically adding a floating div to a page
There are several things you have to do:
You probably want to add some custom CSS to style the div. You can use the stylesheet service.
You have to attach an event handler to the
loadevent ( orDOMContentLoaded), to be notified when a page finished loading. Have a look at Intercepting Page Loads and On page load.You need a reference to element you want the new element append to. Tabbed Browser provides some useful information. E.g. you can get a reference to the
bodyof the current selected tabgBrowser.contentDocument.body.Regarding your code example: You forgot the give the element the CSS property
position: absolute;orposition: fixed;(you have a typo in your code, you wrotepostion), depending on whether it should appear at the bottom of the page or the screen.