What’s this?
And what for?
Could be done like this.
var xhr=new XMLHttpRequest();
xhr.open('GET', '/cgi-bin/index.cgi');
xhr.setRequestHeader('Authorization', 'Basic '+'fail');
xhr.send();
document.location='/';"
imo logout should be should be under the system dropdown list, eg;
<ul>
..
<li>
<a onclick="var xhr=new XMLHttpRequest();xhr.open('GET', '/cgi-bin/index.cgi');xhr.setRequestHeader('Authorization', 'Basic '+'fail');xhr.send();document.location='/';">Logout</a>