What are the limitation using before unload event?

后端 未结 2 881
耶瑟儿~
耶瑟儿~ 2020-12-03 00:05

What is and what is not possible to do inside the beforeunload callback ?

Is it possible to open an XHR/fetch and send data to the server ? If no, is i

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 00:17

    To help some of the people in the comments on the first answer, check out this functionality to make an XHR request during the unload event: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon

提交回复
热议问题