imam kod koji kada se klikne na dugme korisnika treba da izloguje.
kod je
<code>
function ClearAuthentication(LogOffPage)
{
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
var agt=window.navigator.userAgent;
var IsInternetExplorer10 = agt.indexOf('MSIE');
var IsInternetExplorer11 = agt.indexOf('Trident');
var IsEdge = agt.indexOf('Edge');
var IsFirefox = agt.indexOf('Firefox') > -1;
if (IsInternetExplorer10>0 || IsInternetExplorer11>0 || IsEdge>0)
{
$.ajax({
username: 'unknown',
password: 'WrongPassword',
url: './cgi-bin/PrimoCgi',
type: 'GET',
beforeSend: function(xhr)
{
xhr.setRequestHeader("Authorization", "Basic dW5rbm93bjpXcm9uZ1Bhc3N3b3Jk");
},
error: function(err)
{
window.location = 'LogOffPage';
}
});
}
else if(isChrome || IsFirefox)
{
$.ajax({
username: 'unknown',
password: 'WrongPassword',
url: './cgi-bin/PrimoCgi',
type: 'GET',
beforeSend: function(xhr)
{
xhr.setRequestHeader("Authorization", "Basic dW5rbm93bjpXcm9uZ1Bhc3N3b3Jk");
},
error: function(err)
{
window.location = 'http://logout:logout@192.168.0.61';
}
});
}
}
</code>
u internet exploreru i edge-u logout radi ok. medjutim u chrome-u i firefox-u imam stalno problem. nekad prihvati nekad ne. problem mi pravi linija
window.location = 'http://logout:logout@192.168.0.61';
kako ovo resiti?
|