<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>监控窗口是否活动</title> </head> <body> <script> window.addEventListener('blur', ()=>{ document.title = '放入后台'; }, true); window.addEventListener('focus', ()=>{ document.title = '进入页面'; }, true); </script> </body> </html>