document.addEventListener("visibilitychange",function(){
if(document.visibilityState=="visible"){
// console.log("欢迎回来");
location = location
//do something
//继续视频播放
}
if(document.visibilityState=="hidden"){
console.log("不要走!")
//do something else
//暂停视频播放
}
})
参考
https://www.cnblogs.com/wangmaoling/p/8022561.html
https://www.jianshu.com/p/4e5de223b8db
https://blog.csdn.net/weixin_42861240/article/details/94555114
https://blog.csdn.net/gg451516921/article/details/79133029
// window.addEventListener('pageshow', function(event) {
// dispLog("PageShow Event " + event.persisted);
// console.log(event)
// })
网友评论