这篇文章主要介绍了js离开或刷新页面检测(且兼容FF,IE,Chrome)。需要的朋友可以过来参考下,希望对大家有所帮助
复制代码 代码如下: <!DOCTYPE html> <html> <head> <script> function closeIt() { return "Any string value here forces a dialog box to \n" + "appear before closing the window."; } window.onbeforeunload = closeIt; </script> </head> <body> <a href="//www.jb51.net">Click here to navigate to www.jb51.net</a> </body> </html>