Accessing the DOM from within the Firefox extension
There seems to be no documentaion whatsoever for building Firefox extensions except for some good ol’ chaps who have put up brilliant tutorials on their weblogs (thanks guys). All I wanted to do was access the current windows DOM from within my extension. But for this trivial task I had to go to the extent of reading source code of various extensions )-:
One of the ways to access the DOM is as follows:
// Get the content of the currently displaying window
var win = window.content;
// Access the document within the window as follows
win.document.getElementById(’xyz’);
As easy as that.
January 25th, 2008 at 3:27 am
I know this is an old post but I wanted to thank you nonetheless. This answers a question I’ve been trying to answer for two days now. There’s absolutely no documentation on this anywhere, at least none that I could find. So, thanks
May 6th, 2008 at 8:30 pm
Ah, such a simple question, and here I finally found the answer. Just starting out in FF extension programming and after viewing the code of lots of fancy toolbars, I gave up and then searched/found this page instead. THANKS
November 2nd, 2008 at 7:57 am
I just wanted to say thank you too! It saved me a ton of time finding your post. This is the only link that the great Google provided me that actually helped. Thanks again!