سلام محسن جان
طبق میلی که زده بودی بررسی کردم و جواب رو واست میذارم اینجا
<script type="text/javascript">
var logout = function() {
var xhr = new XMLHttpRequest;
xhr.open("GET", "logout.php", false);
xhr.send(null);
};
window.onbeforeunload = function() {
if...