How to detect if a user leaves a page in PHP

前端 未结 5 1571
Happy的楠姐
Happy的楠姐 2020-12-20 20:02

There is this function which i want to execute in case the user leaves a particular page. This function will basically change all of the data within a certain column in my d

5条回答
  •  不思量自难忘°
    2020-12-20 20:22

    With 100% reliability, no, it's not possible. Since leaving a particular page is a client-side operation, you have 0 control over what the client does. You can register an onbeforeunload handler via Javascript and hope that the client browser supports it. But again, support for this isn't universal.

提交回复
热议问题