Popup detection before user logs in(用户登录前的弹窗检测)
问题描述
有没有一种好方法可以确定一个人是否启用了弹出窗口阻止程序?我需要维护一个 Web 应用程序,不幸的是它有大量的弹出窗口,我需要检查用户是否启用了弹出窗口阻止程序.
Is there a good way to determine if a person has a popup blocker enabled? I need to maintain a web application that unfortunately has tons of popups throughout it and I need to check if the user has popup blockers enabled.
我发现这样做的唯一方法是从 javascript 打开一个窗口,检查它是否打开以确定是否启用了阻止程序,然后立即将其关闭.
The only way I've found to do this is to open a window from javascript, check to see if it's open to determine if a blocker is enabled and then close it right away.
这有点烦人,因为没有启用它的用户会在窗口立即打开和关闭时看到屏幕上的小闪烁.
This is slightly annoying since users who do not have it enabled see a small flash on the screen as the window opens and closes right away.
有没有其他不显眼的方法来实现这一点?
Are there any other non-obtrusive methods for accomplishing this?
推荐答案
阅读使用 Javascript 检测弹出窗口拦截器:
基本上你检查 'window.open' 方法是否返回一个新打开窗口的句柄.
Basically you check if the 'window.open' method returns a handle to a newly-opened window.
看起来像这样:
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(mine)
var popUpsBlocked = false
else
var popUpsBlocked = true
mine.close()
这篇关于用户登录前的弹窗检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用户登录前的弹窗检测


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