JS/JQuery detects whether the page is refreshed or closed and performs AJAX requests.
phpcn_u5220
phpcn_u5220 2017-07-03 09:06:23
0
4
1408

onbeforeunload() and onunload() have been tried, including the AJAX methods provided online.

onbeforeunload(), IE and Chrome support it, but the function cannot be executed. It can only return a prompt string. The onunload() method is not supported by Chorme and the IE effect is not good. Please give me some advice on whether there is a better method.

This is mainly used for users to judge whether they are online or offline. Method to prevent the page from not being logged in after it is closed.

phpcn_u5220
phpcn_u5220

reply all (4)
︶ㄣyi個┐L

It would be great if I could show you the code

    phpcn_u5220

    I solved it with cooking.

      Ty80

      Use websocket long link, the PHP side monitors the socket port number, the session is saved in the database, and the PHP side clears the session record in the database after disconnection.

        phpcn_u5220

        Already solved

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!