Is it possible to switch browser tab?(是否可以切换浏览器选项卡?)
问题描述
这是我的要求,
我正在开发一个相当老的企业应用程序,它只支持 IE 浏览器.现在,用户有可能从此应用程序中打开多个选项卡/窗口.我使用 jQuery idleTimer Plugin 为我们的目的编写了一个自定义超时插件.当倒计时达到 10 或小于 10 时,我需要切换到此选项卡/窗口,以使用户知道该页面将在 10 秒内过期.
I'm working on a enterprise application which is quite old, and it supports IE browser only. Now, there are chances that the user could open multiple tab/window from this application. I have written a custom timeout plugin for our purpose with jQuery idleTimer Plugin. When the countdown reaches 10 or less than 10, i need to switch to this tab/window to make the user aware that the page gets expired in less than 10 seconds.
那么,有没有办法解决这个问题?我试过 window.focus()
但不起作用.
So, is there a solution for this? I have tried window.focus()
but does not work.
推荐答案
没有一种跨浏览器的方式可以切换 100% 可靠的选项卡,尤其是在较新的浏览器中.它在大多数较新的浏览器中被主动阻止.作为用户,我很高兴在大多数情况下很难做到这一点,而在其他情况下是不可能做到的.
There isn't a cross-browser way do switch a tab that's 100% reliable, especially in newer browsers. It's actively blocked in most newer browsers. As a user, I'm glad it's difficult in most cases, impossible in others to do this.
这篇关于是否可以切换浏览器选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以切换浏览器选项卡?


- 失败的 Canvas 360 jquery 插件 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Fetch API 如何获取响应体? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01