用户登录前的弹出检测 [英] Popup detection before user logs in

查看:71
本文介绍了用户登录前的弹出检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种好方法可以确定一个人是否启用了弹出窗口拦截器?我需要维护一个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()

这篇关于用户登录前的弹出检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆