当前位置:网站首页>In the closing pages/uninstall (unload) sends a request to the server before the document
In the closing pages/uninstall (unload) sends a request to the server before the document
2022-08-11 04:54:00 【qq_46302247】
Official introduction: https://developer.mozilla.org/zh-CN/docs/Web/API/Navigator/sendBeacon
For reference: https://www.jianshu.com/p/04e88271a8f2?from
Ultimate Solution:
window.addEventListener("beforeunload", (e) => {const data = {name: "tm"};window.navigator.sendBeacon("http://127.0.0.1:1891/loginout", JSON.stringify(data));});
Whether the page is refreshed or closed, the backend can receive the request sent by the frontend, perfectly fulfilling the requirement.
边栏推荐
- 对象的创建以及显示转换
- async(异步)和await的使用
- Switches and routers technology - 26 - configure OSPF peripheral area
- JVM 垃圾回收的概述与机制
- Switch and Router Technology-27-OSPF Route Redistribution
- 【FPGA教程案例49】控制案例1——基于FPGA的PID控制器verilog实现
- ERROR: Could not install packages due to an OSError: [Errno 2] 没有那个文件或目录: ‘/data/xxxx
- Zabbix builds enterprise-level monitoring and alarm platform
- 我的LaTeX入门
- C语句:数据存储
猜你喜欢
Switch and Router Technology-27-OSPF Route Redistribution
网络协议1
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/data/xxxx
破解事务性工作瓶颈,君子签电子合同释放HR“源动力”!
网络安全培训机构哪家好?排名怎么选择?
Switch and Router Technology-29-OSPF Virtual Link
优化是一种习惯●出发点是“站在靠近临界“的地方
交换机和路由器技术-32-命名ACL
无线电射频能量的收集
The sword refers to offer_abstract modeling capabilities
随机推荐
Redis: Solve the problem of modifying the same key with distributed high concurrency
How to read a paper
leetcode 9. 回文数
CAN/以太网转换器 CAN与以太网互联互通
0基础转行软件测试,自学3个月,浅拿12k*13薪offer
[QNX Hypervisor 2.2用户手册]10.15 vdev timer8254
视觉任务种常用的类别文件之一json文件
Mysql: set the primary key to automatically increase the starting value
【服务器安装mysql】centos7下使用mysql离线安装包安装mysql5.7
Jetson Orin platform 4-16 channel GMSL2/GSML1 camera acquisition kit recommended
Use Navicat Premium to export database table structure information to Excel
网络安全培训机构哪家好?排名怎么选择?
【FPGA教程案例50】控制案例2——基于FPGA的PD控制器verilog实现
剑指offer_抽象建模能力
交换机和路由器技术-30-标准ACL
【ImageNet】数据集1000个类的名称
async(异步)和await的使用
FPGA工程师面试试题集锦111~120
send_sig: kernel execution flow
Paper Notes: BBN: Bilateral-Branch Network with Cumulative Learning for Long-Tailed Visual Recognition