在我的公司,我設計了一個用於Intranet庫存的php-mysql-jquery網站。 Web服務器(iis8)位於連接到Active Directory的Windows 8計算機中。我需要爲我的網站提供AD身份驗證,爲此,我啓用了Windows身份驗證功能,以在用戶訪問我的網站之前對用戶進行身份驗證。從Windows身份驗證註銷
該功能工作正常,用戶現在可以登錄!但我需要他們從網站註銷。但我無法在互聯網上找到任何代碼來執行此操作。我現在需要做的是告訴用戶重新啓動瀏覽器並清除瀏覽器歷史記錄。有人知道這件事嗎?有其他方法嗎?
我想這個代碼
html><head>
<script type="text/javascript">
function logout() {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}
// code for IE
else if (window.ActiveXObject) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (window.ActiveXObject) {
// IE clear HTTP Authentication
document.execCommand("ClearAuthenticationCache");
window.location.href='/where/to/redirect';
} else {
xmlhttp.open("GET", '/path/that/will/return/200/OK', true, "logout", "logout");
xmlhttp.send("");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {window.location.href='/where/to/redirect';}
}
}
return false;
}
</script>
</head>
<body>
<a href="#" onclick="logout();">Log out</a>
</body>
</html>
是什麼/路/是/會/返回/ 200/OK?
試試這個職位:http://stackoverflow.com/questions/449788/http-authentication-logout-via-php – Niels