- const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
- const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;
- var myListener =
- {
- QueryInterface: function(aIID)
- {
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
- return this;
- throw Components.results.NS_NOINTERFACE;
- },
- onStateChange: function(aWebProgress, aRequest, aFlag, aStatus)
- {
- // If you use myListener for more than one tab/window, use
- // aWebProgress.DOMWindow to obtain the tab/window which triggers the state change
- if(aFlag & STATE_START)
- {
- // This fires when the load event is initiated
- }
- if(aFlag & STATE_STOP)
- {
- // This fires when the load finishes
- }
- },
- onLocationChange: function(aProgress, aRequest, aURI)
- {
- // This fires when the location bar changes; i.e load event is confirmed
- // or when the user switches tabs. If you use myListener for more than one tab/window,
- // use aProgress.DOMWindow to obtain the tab/window which triggered the change.
- },
- // For definitions of the remaining functions see related documentation
- onProgressChange: function(aWebProgress, aRequest, curSelf, maxSelf, curTot, maxTot) { },
- onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) { },
- onSecurityChange: function(aWebProgress, aRequest, aState) { }
- }
Code Collected and Organised By:-
Shashank Kandhawe
mailto: kandhawe1@gmail.com
Monday, November 29, 2010
WEB Progress Listener
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment