navigator.sendBeacon(url, data)
用于向服务器异步发送小的HTTP数据。主要用于满足统计和诊断代码的需要。
- 默认是发post请求,后端需要能够post接收数据
- Beacon API不提供相应的回调,因此后端返回最好省略response body,(例如,204 No Content)
- navigator.sendBeacon()之后的代码可以执行
navigator.sendBeacon
标签:需要 代码 接收 pre content 数据 nbsp res pos