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


基础教程推荐
- 每次设置弹出窗口的焦点 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01