当前位置:网站首页>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.
边栏推荐
猜你喜欢

破解事务性工作瓶颈,君子签电子合同释放HR“源动力”!

交换机和路由器技术-24-OSPF单区域配置

交换机和路由器技术-28-OSPF的NSSA区域

交换机和路由器技术-34-动态NAT
![ERROR: Could not install packages due to an OSError: [Errno 2] 没有那个文件或目录: ‘/data/xxxx](/img/02/3896b29a955ae84a0f0326f0d2cabf.png)
ERROR: Could not install packages due to an OSError: [Errno 2] 没有那个文件或目录: ‘/data/xxxx

嵌入式分享合集33

Switch and Router Technology-27-OSPF Route Redistribution

Switch and Router Technology - 25 - OSPF Multi-Area Configuration

网络协议1

交换机和路由器技术-32-命名ACL
随机推荐
form表单提交数据库中文变成问号
0 Basic software test for career change, self-study for 3 months, 12k*13 salary offer
剑指offer_抽象建模能力
[QNX Hypervisor 2.2用户手册]10.16 vdev virtio-blk
Switch---Spanning Tree---Three-layer Architecture Summary
Kong实现禁止国外IP访问
开发工具篇第七讲:阿里云日志查询与分析
02.折叠隐藏文字
Network Skill Tree
JVM 垃圾回收的概述与机制
【FPGA教程案例49】控制案例1——基于FPGA的PID控制器verilog实现
Overview of the JVM garbage collection and mechanism
Self-research capability was recognized again, and Tencent Cloud Database was included in the Forrester Translytical report
Licking - frog jumping steps
【实战场景】商城-折扣活动设计方案
4 模块三:文献阅读与研究方法
Smart Pointer Notes
我的LaTeX入门
Mysql: set the primary key to automatically increase the starting value
【电商运营】社交媒体营销策略该如何制定?