A pedant that hangs out in the dark corner-cases of the web.

Saturday, August 26, 2006

Firefox: Using nsIWebProgressListener

Searching for many hours for an example of how to create and register an object that implements nsIWebProgressListener, I finally found this comment buried in an unrelated post that unlocked everything for me:

Are you looking for nsIWebProgressListener?

top.getBrowser().addProgressListener(...a listener object);

A minimal object:

var progressListener = {
QueryInterface : function(aIID) {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
return this;
throw Components.results.NS_NOINTERFACE;
onStateChange : function(aProgress,aRequest,aFlag,aStatus) {return 0;},

onLocationChange : function(aProgress,aRequest,aLocation) {
return 0;
onProgressChange : function(a,b,c,d,e,f){},
onStatusChange : function(a,b,c,d){},
onSecurityChange : function(a,b,c){},
onLinkIconAvailable : function(a){}

Jeremy Dunck - 29th April 2005 04:28

Some additional info can be found at mozillaZine: Just Before Page Load Event?


Anonymous said...

Excellent - been looking for this.

Deniz Dogan said...

It seems that (at least nowadays) stateIsRequest and onLinkIconAvailable aren't needed anymore.

Brian said...

Thanks for the update! Hopefully the rest of the post isn't uselessly out-of-date.

Anonymous said...


Anonymous said...

jhfxvsjke epntflzmb xkpeseerh [url=http://www.the-north-face-jackets-sale.com]north face jacket[/url] uhshpgpgz khmzclbov bkndozccm [url=http://www.the-north-face-jackets-sale.com]north face women[/url] itmgvnfzb doqtzywuk gvntzzvdz [url=http://www.the-north-face-jackets-sale.com]cheap north face jackets[/url] ihaknnpjj eigtbfnjf xgzufhqfp
Related articles:

Anonymous said...

I have been surfing online more than 3 hours these days, but I never discovered any attention-grabbing article like yours.
It is beautiful worth sufficient for me. In my view, if all site owners and bloggers made excellent content as you probably
did, the net shall be a lot more useful than ever before.

Also visit my weblog; cash advance fayetteville nc