I have tried all possible ways to logout completely from ganglia, but I could not make it. So decided to pass wrong username and password to invalidate basic authentication. Added below javascript method in header.tpl file, called the below function while clicking on logout link.
function logoff() {
try {
$.ajax({
url: '/login.php',
username: 'reset',
password: 'reset',
statusCode: { 401: function() { alert('Logged Out') } }
});
} catch (exception) {
document.execCommand("ClearAuthenticationCache");
}
return false;
}