If you have done some scripting with MooTools and Ajax you may find the following information useful. As it is, I could not find an easy way to detect when a user was logged out of Joomla in the administration control panel for an Ajax request.
Initially I tried overriding the mod_login and com_user views but this dis not work for me. Then I tried to do a simple content plugin which did not show up on the authentication page. Finally, I decided to try a system plugin. One thing to note here is that if you hook the wrong function you will not get the correct component option. ( ie index.php?option=com_login ). You have to wait until the dispatch has been called in order to hook it. After you have hooked the dispatch you can simply write out a json string and close the frame and you are complete.
Here is the plugin code for reference.
defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.plugin.plugin' ); class plgSystemAjaxCheck extends JPlugin{ function plgSystemAjaxCheck(& $subject, $config){ parent::__construct($subject, $config); } function onAfterDispatch(){ global $mainframe ; if ( JRequest::getVar("option") == "com_login" ){ $h = getallheaders(); if((isset($h["x-requested-with"])&&strtolower($h["x-requested- with"])=="xmlhttprequest")|| (isset($h["X-Requested-With"])&&$h["X-Requested-With"]=="XMLHttpRequest")){ $ajax_context = true ; echo "{error:'login'}"; $mainframe--->close(); } } } }
Download the plugin from here