<bdo id='VDYqn'></bdo><ul id='VDYqn'></ul>

  1. <i id='VDYqn'><tr id='VDYqn'><dt id='VDYqn'><q id='VDYqn'><span id='VDYqn'><b id='VDYqn'><form id='VDYqn'><ins id='VDYqn'></ins><ul id='VDYqn'></ul><sub id='VDYqn'></sub></form><legend id='VDYqn'></legend><bdo id='VDYqn'><pre id='VDYqn'><center id='VDYqn'></center></pre></bdo></b><th id='VDYqn'></th></span></q></dt></tr></i><div id='VDYqn'><tfoot id='VDYqn'></tfoot><dl id='VDYqn'><fieldset id='VDYqn'></fieldset></dl></div>
  2. <tfoot id='VDYqn'></tfoot>

    1. <legend id='VDYqn'><style id='VDYqn'><dir id='VDYqn'><q id='VDYqn'></q></dir></style></legend>

      <small id='VDYqn'></small><noframes id='VDYqn'>

      在不打开弹出窗口的情况下检测被阻止的弹出窗口

      Detect Blocked popups without opening a popup(在不打开弹出窗口的情况下检测被阻止的弹出窗口)

          <tbody id='juEo1'></tbody>

            <legend id='juEo1'><style id='juEo1'><dir id='juEo1'><q id='juEo1'></q></dir></style></legend>
            • <i id='juEo1'><tr id='juEo1'><dt id='juEo1'><q id='juEo1'><span id='juEo1'><b id='juEo1'><form id='juEo1'><ins id='juEo1'></ins><ul id='juEo1'></ul><sub id='juEo1'></sub></form><legend id='juEo1'></legend><bdo id='juEo1'><pre id='juEo1'><center id='juEo1'></center></pre></bdo></b><th id='juEo1'></th></span></q></dt></tr></i><div id='juEo1'><tfoot id='juEo1'></tfoot><dl id='juEo1'><fieldset id='juEo1'></fieldset></dl></div>

              <tfoot id='juEo1'></tfoot>

              <small id='juEo1'></small><noframes id='juEo1'>

                <bdo id='juEo1'></bdo><ul id='juEo1'></ul>

                本文介绍了在不打开弹出窗口的情况下检测被阻止的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                关于如何检查弹出窗口是否在我的浏览器上被阻止"这个问题已被多次提出,我发现的所有解决方案都提出了一个解决方案,即打开一个新的弹出窗口进行测试.

                This question has been raised many times on "How to check if the popup is blocked on my browser or not" and all the solutions that i found have proposed a solution where a new popup window is opened for testing.

                参考资料:

                1. "检测 Chrome 中被阻止的弹出窗口"

                "如何检测浏览器是否阻止了弹出窗口?"

                等等.

                我想知道是否有可能知道一个被阻止的弹出窗口,而无需实际打开一个.

                I would like to know if there is any possibility of knowing a blocked popup, without actually opening one.

                由于许多原因,测试弹出窗口可能需要一段时间才能关闭,这在您的应用程序的起始页上看起来很丑.

                Because due to many reasons the test pop up may take time to close, which looks ugly on start-page of your application.

                例如,如果我们可以使用来自客户端的请求标头中的任何内容,了解弹出首选项等,就像我们可以获得语言首选项一样.

                For example if we could use anything from the request header from the client, to know the popup preferences etc like we can get for the language preferences.

                这将是一个巨大的帮助.谢谢

                It'll be a huge help. Thanks

                推荐答案

                据我所知,弹出窗口拦截器的工作原理是覆盖 window.open 函数,并且在大多数情况下返回 null.所以一种方法是检测 window.open 是否仍然是 nativ 函数.

                As far as I know, popup blockers works by overwrite a window.open function and in most cases return a null. So one way is to detect if window.open is still nativ function.

                您可以使用 toString 方法对其进行测试,该方法返回 [native code] 作为该函数的主体.toString 在旧的 IE 中不起作用,所以使用 ''+ 来转换函数.

                You can test that with toString method, which return [native code] as a body of that function. toString not work in old IE, so instead of that use ''+ to convert function.

                var havePopupBlockers = ('' + window.open).indexOf('[native code]') === -1;

                这不是灵丹妙药,但可以检测潜在风险.我在 Chrome、FF、IE8 和 IE9 上使用一些不同的弹出窗口拦截器和作品进行了测试.

                This is not silver bullet, but can detect potential risk. I test this on Chrome, FF, IE8 and IE9 with some various popup blockers and works.

                这篇关于在不打开弹出窗口的情况下检测被阻止的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                Ordinals in words javascript(javascript中的序数)

                  <i id='isL8Z'><tr id='isL8Z'><dt id='isL8Z'><q id='isL8Z'><span id='isL8Z'><b id='isL8Z'><form id='isL8Z'><ins id='isL8Z'></ins><ul id='isL8Z'></ul><sub id='isL8Z'></sub></form><legend id='isL8Z'></legend><bdo id='isL8Z'><pre id='isL8Z'><center id='isL8Z'></center></pre></bdo></b><th id='isL8Z'></th></span></q></dt></tr></i><div id='isL8Z'><tfoot id='isL8Z'></tfoot><dl id='isL8Z'><fieldset id='isL8Z'></fieldset></dl></div>

                    <tbody id='isL8Z'></tbody>
                  • <bdo id='isL8Z'></bdo><ul id='isL8Z'></ul>

                    <small id='isL8Z'></small><noframes id='isL8Z'>

                    <legend id='isL8Z'><style id='isL8Z'><dir id='isL8Z'><q id='isL8Z'></q></dir></style></legend>

                      <tfoot id='isL8Z'></tfoot>