首页 > 其他分享 >页面切换到后台,再切回时跳转页面

页面切换到后台,再切回时跳转页面

时间:2023-09-21 11:01:41浏览次数:41  
标签:index 再切 跳转 new pageVisibility 页面

    document.addEventListener('visibilitychange', function () {
        let pageVisibility = document.visibilityState;
        // 页面变为不可见时触发
        if (pageVisibility == 'hidden') {
            console.log("离开时间点:" + new Date());
        }
        // 页面变为可见时触发
        if (pageVisibility == 'visible') {
            window.location.href = "https://dh.new-game.cn/index/index/episodeSuccess";
        }
    })

 

标签:index,再切,跳转,new,pageVisibility,页面
From: https://www.cnblogs.com/zdcblog/p/17719375.html

相关文章

  • 【简洁】【皮肤美化】博客园页面美化 主文章加宽
    选择:Bluesky皮肤再加入的css:#home{background-color:#e6e6e6;}#top_nav{background-color:#e6e6e6;}#navigator,#under_post_card1,#ad_t2,#nav_right,#nav_left,#cnblogs_c1,#under_post_card2,#HistoryToday,#green_channel,.author_avatar{display......
  • 歌手页面收藏功能之本地存储localstorage之save
    收藏功能:一、本地存储代码,array-storage.js:importstoragefrom'good-storage' functioninsertArray(arr,val,compare){ constindex=arr.findIndex(compare) if(index>-1){  //index>-1说明val在arr中存在  return } arr.unshift(val)......
  • IIS报错:HTTP 错误 404.2 - Not Found 由于Web服务器上的”ISAPI和CGI限制”列表设置,无
     解决方法:  ......
  • 企业微信内置应用的h5页面,内部按钮关闭页面
    以下内容非原创,遇到这个问题,查到这位大佬的做法,所以记录下来,以便于之后自己查阅。原文链接:https://blog.csdn.net/qq_22182989/article/details/125674826遇到的问题:在做vue项目时,需求是要在微信环境内。微信h5页面要求前端控制退出时关闭页面功能。如果是在微信外其他浏览器......
  • 页面层次拖拽效果
    <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <headrunat="server"> <......
  • dedebiz内容页面获取当前页面路径的标签
    dedebiz获取当前页面路径的标签,仅在内容页使用,栏目页没有效果的。{dede:fieldname='arcurl'/}在栏目页想获取当前栏目的路径及名称的话,就要用下面这个标签。{dede:type}<ahref="[field:typelink/]">[field:typename/]</a>{/dede:type}获取网站所有栏目名称及路径列......
  • vue_vueRouter同组件跳转失败
    目录场景再现资料查询解决场景再现现有一个Article页面,通过/article/:id来匹配不同的文章页面,当我需要实现跳转到上一篇或下一篇时,即从/article/:id跳转另一个/article/:id时,发现浏览器中只有地址变化了,但是页面的很多组件,包括文章内容都没有刷新,资料查询这......
  • 跳转到应用市场下载
    ps:自用的,在此简单记录 //判断应用市场judeBrand(){constuserAgent=navigator.userAgent.toLowerCase()constisIphone=userAgent.match(/(iphone|ipad|ipod)/i);constisHuawei=userAgent.match(/huawei/i);constisHonor=userAgent.match(/honor/i......
  • HarmonyOS 管理页面跳转及浏览记录导航
    历史记录导航使用者在前端页面点击网页中的链接时,Web组件默认会自动打开并加载目标网址。当前端页面替换为新的加载链接时,会自动记录已经访问的网页地址。可以通过forward()和backward()接口向前/向后浏览上一个/下一个历史记录。在下面的示例中,点击应用的按钮来触发前端页面的后......
  • springMvc页面跳转---重定向和转发
    准备工作1.导入json依赖点击查看代码<!--jsp需要依赖!jstl--><dependency><groupId>jakarta.servlet.jsp.jstl</groupId><artifactId>jakarta.servlet.jsp.jstl-api</artifactId><version>3.......