I make an Ext.ajax.request, and when the server sends back a 401 not authorized the browser pops up its own gui.

I want my Ext.ajax.reqeust to get the 401 "before" the browser does so I can take my own action and stop the browsers from popping up their own "Authentication Required".

I have already tried Ext.Ajax.on('requestexception', function (conn, response, options) and it does get called but after the browser intercepts and shows it gui.

Is there a setting or way to have Ext.Ajax intercept the 401 before the browser does.