在Firefox固定选项卡中关闭浏览器后,会话不会过期或用户不会注销


Session doesn't expire or user logged out after browser close in a Firefox pinned tab

问题在这里

在所有浏览器和Firefox unpinned选项卡上都可以正常工作,但在Firefox固定标签的情况下:当关闭浏览器并再次返回时,仍然登录

我使用这两行来强制会话在浏览器关闭时过期。

ini_set('session.cookie_lifetime', 0);
session_set_cookie_params(0);

使用session_destroy()功能关闭浏览器。
logout.php

//This is the page that will destroy all your session, call the code on this page before the browser is closed.
<?php session_start();
session_destroy();
?>

mypage.php

<script> // use ajax call to execute the code on before unload page mypage.hp
window.onbeforeunload = function(){ //send a small ajax call to logout.php so that the session wil get destroyed 
     $.ajax({
     method:'post',
     url: 'logout.php',
     data: 'nothing'
     })
}
</script>