使用sendBeacon 实现关闭窗口调用接口
window.onunload = (e) => {_gap_time = new Date().getTime() - _beforeUnload_time;
if (_gap_time <= 5) {
var blob = new Blob(, {
type: 'application/json; charset=UTF-8',
});
if (id) {
console.log('关闭')
navigator.sendBeacon("/api/services/app/commonSignature/CancelAuthByUserId", blob)
}
}
else {
console.log("刷新")
}
}
window.onbeforeunload = (e) => {
_beforeUnload_time = new Date().getTime()
}
使用sendBeacon 发起异步请求
使用blbo将传参方式更换为json
页:
[1]