Wow -- thanks VERY MUCH from me also hendricd -- your code makes session timeouts a breeze to handle.
In my application, I simply included "ext-basex-min.js" as described above, and then added a single call to Ext.lib.Ajax.onStatus(...) also as described above. This works very great for handling session timeouts reported by my server-side code.
However, please note the following bug and (hopefully sound) fix I implemented. My code is far too large to post here, but I'll describe the problem as best I can.
My application contains a GridPanel populated by a JsonStore. User clicks on other elements on the screen trigger the JsonStore (and therefore the GridPanel) to reload with applicable data from the server. It's very possible for a user to trigger the reloading of the JsonStore before a previous load was completed. This worked fine without the "ext-basex-min.js" in my app, but including that file (without even calling anything in it) caused IE6 & 7 to trigger a JavaScript error in this situation. Firefox still worked fine though.
My fix involves moving a single line of code into an existing try/catch block as indicated in these snippets.
Old:
Code:
createResponseObject:function(o, callbackArg){
var obj = {};
var headerObj = {},headerStr='';
try{ //to catch bad encoding problems here
obj.responseText = o.conn.responseText;
}catch(e){obj.responseText ='';}
obj.responseXML = o.conn.responseXML;
try{
headerStr = o.conn.getAllResponseHeaders()||'';
} catch(ex){}
New:
Code:
createResponseObject:function(o, callbackArg){
var obj = {};
var headerObj = {},headerStr='';
try{ //to catch bad encoding problems here
obj.responseText = o.conn.responseText;
}catch(e){obj.responseText ='';}
try{
obj.responseXML = o.conn.responseXML;
headerStr = o.conn.getAllResponseHeaders()||'';
} catch(ex){}
This seems to meet the need in my app, but maybe there's a better fix?
Questions and comments are very welcome!
Thanks again,
-radio1