[Project_owners] How to obtain the scrollbar positions of
jaap at haitsma.org
Sat Aug 7 18:37:35 EDT 2004
>> No, I thought loadURI was synchronous. How do I know when the page is
> Add a load event handler. Search navigator.js for loadEventHandlers for
> an example.
Thanks, I'm almost there.
The code you suggested is below. This works but then loadEventHandlers
is called for a reload in every tab and I have to know in which tab it
// Add a capturing event listener to the content area
//(rjc note: not the entire window, otherwise we'll get sidebar pane
// so we'll be notified when onloads complete.
var contentArea = document.getElementById("appcontent");
contentArea.addEventListener("load", loadEventHandlers, true);
So I tried to set it up for every tab, but haven't been succesful :-(
I tried this
// Setup listener for this tab
// tab is a variable which I have obtained
// by calling tab = getBrowser().mCurrentBrowser;
// sometime in the program
tab.reloadEveryLoadFinished = reloadEveryLoadFinished;
tab.addEventListener("load", tab.reloadEveryLoadFinished, true);
tab.webNavigation.loadURI(tab.reloadEveryURL, loadFlags, null,
// The listener
dump ("yes!!!, the page is reloaded");
If I then do a loadURI in different tabs different tabs I know which tab
was reloaded because reloadEveryLoadFinished() is a member of the tab
class and so I can obtain the this pointer.
Problem however is that reloadEveryLoadFinished() gets called twice.
just before and just after the reload.
So I tried to use the note of rjc in the navigator.js code
var contentArea = tab.contentWindow.document.getElementById("appcontent");
Unfortunately appcontent does not seem to exist in that case.
contentArea is just empty in this case.
I also see another potential problem if a user loads a page himself the
listener will also be called.
So my problem is how to do a loadURI and know that that specific loadURI
Or is it, if I setup the listener just before calling loadURI that I
know for sure that it is my page that got reloaded when the listener is
More information about the Project_owners