语法:navigator.sendBeacon(url, data); 例子: window.addEventListener("beforeunload", (e) => { window.navigator.sendBeacon(url, '测试发送的数据'); });
参考链接:https://developer.mozilla.org/zh-CN/docs/Web/API/Navigator/sendBeacon
语法:navigator.sendBeacon(url, data); 例子: window.addEventListener("beforeunload", (e) => { window.navigator.sendBeacon(url, '测试发送的数据'); });
参考链接:https://developer.mozilla.org/zh-CN/docs/Web/API/Navigator/sendBeacon