this._onUnloadHandler(); // display loading message this._setContent( this.onDownloadStart.call(this) ); var self = this; var getArgs = { preventCache: (this.preventCache || this.refreshOnShow), url: this.href, handleAs: "text" }; if(dojo.isObject(this.ioArgs)){ dojo.mixin(getArgs, this.ioArgs); } var hand = this._xhrDfd = (this.ioMethod || dojo.xhrGet)(getArgs); hand.addCallback(function(html){ try{ self.onDownloadEnd.call(self); self._isDownloaded = true; self.setContent.call(self, html); // onload event is called from here }catch(err){ self._onError.call(self, 'Content', err); // onContentError } delete self._xhrDfd; return html; }); hand.addErrback(function(err){ if(!hand.cancelled){ // show error message in the pane self._onError.call(self, 'Download', err); // onDownloadError } delete self._xhrDfd; return err; });