Appreciate!
Pengyu
> Anyone has experience with addProgressListener to share?
// Associate the progress listener for a "browser" to a listener object:
browserObject.addProgressListener( listObj,
Components.interfaces.nsIWebProgress.NOTIFY_STATE_WINDOW );
// Remember to define the object, something like this:
listObj = new Object();
listObj.wpl = Components.interfaces.nsIWebProgressListener;
listObj.QueryInterface = function(aIID) {
if (aIID.equals(listObj.wpl) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports)) return this;
throw Components.results.NS_NOINTERFACE;
}
listObj.onStateChange = function(aProgress, aRequest, aFlag, aStatus) {
if (aFlag & listObj.wpl.STATE_START) {
// This fires when the load event is initiated
} else {
if (aFlag & listObj.wpl.STATE_STOP) {
if ( aFlag & listObj.wpl.STATE_IS_WINDOW ) {
// This fires when ALL load finish
}
if ( aFlag & listObj.wpl.STATE_IS_NETWORK ) {
// Fires when ALL load are REALLY over,
// do something "final" here
// (my two cents)
} else {
// This fires when a load finishes
}
}
}
return 0;
}
// This fires when the location bar changes i.e load event is confirmed
// or when the user switches tabs
listObj.onLocationChange = function(aProgress, aRequest, aURI) {
// do whatever you want to do
return 0;
}
// For definitions of the remaining functions see XulPlanet.com
listObj.onProgressChange = function() { return 0 };
listObj.onStatusChange = function() { return 0 };
listObj.onSecurityChange = function() { return 0 };
listObj.onLinkIconAvailable = function() { return 0 };
/*
I use the progress listener to trap the end of a local HTML
"template" file loading, and run XSLT transormations.
In addition I need to evaluate the browser contentDocument DOM
in order to clean "target" attributes on links, and so on.
HTH
*/
--
Fletto i muscoli e sono nel vuoto
"Marco Balestra" <bale...@faqintosh.com> wrote in message
news:1hp955a.14sclu0tw6a7oN%bale...@faqintosh.com...
This thread is quite old, but I would like to resume it due to a situation
that I am experiencing.
My question is, on the sequence you described, where will the DOM
unloadevent of the former page be generated? Is it possible that it
will be
generated after the onLocationChange event?
Thanks in advance for your help
Cheers,
Oliveiros
2006/11/23, Marco Balestra <bale...@faqintosh.com>:
> _______________________________________________
> dev-tech-xul mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xul
>
Can anyone else please help me with this question, please ?
Thanks in advance
Cheers,
Oliveiros
----- Original Message -----
From: "Oliveiros Cristina" <oliveiros...@gmail.com>
To: "Marco Balestra" <bale...@faqintosh.com>
Cc: <dev-te...@lists.mozilla.org>
Sent: Wednesday, May 23, 2007 11:25 AM
Subject: Re: addProgressListener
> Hello, Marco.
>
> This thread is quite old, but I would like to resume it due to a situation
> that I am experiencing.
> My question is, on the sequence you described, where will the DOM
> unloadevent of the former page be generated? Is it possible that it
> will be
> generated after the onLocationChange event?
>
> Thanks in advance for your help
>
> Cheers,
> Oliveiros
>
> 2006/11/23, Marco Balestra <bale...@faqintosh.com>:
>>
Can anyone please kindly help me?
If this is not the right list for this question, please kindly redirect me
to the appropriate list please
Thanx in advance
Kind Regards,
-> extensions or DOM.
> Thanx in advance