[英]Determine the close button click of Browser, refresh and going to new page
i have to clear session and delete some data from my database on browser close/refresh/location change 我必须清除会话并在浏览器关闭/刷新/位置更改时从我的数据库中删除一些数据
i need a code which could do something like this 我需要一个可以做这样的代码
$('cross button,refresh').click(function()
{
preventdefault();
// call my delete script
$(browser).close();
});
$(window).on("beforeunload", function() {
// Your code here
});
This will trigger when the user tries to leave the page. 当用户尝试离开页面时,这将触发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.