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.
这篇关于是否可以切换浏览器选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以切换浏览器选项卡?


基础教程推荐
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01