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

<tfoot id='wuyy6'></tfoot>
        • <bdo id='wuyy6'></bdo><ul id='wuyy6'></ul>
      1. <small id='wuyy6'></small><noframes id='wuyy6'>

      2. <i id='wuyy6'><tr id='wuyy6'><dt id='wuyy6'><q id='wuyy6'><span id='wuyy6'><b id='wuyy6'><form id='wuyy6'><ins id='wuyy6'></ins><ul id='wuyy6'></ul><sub id='wuyy6'></sub></form><legend id='wuyy6'></legend><bdo id='wuyy6'><pre id='wuyy6'><center id='wuyy6'></center></pre></bdo></b><th id='wuyy6'></th></span></q></dt></tr></i><div id='wuyy6'><tfoot id='wuyy6'></tfoot><dl id='wuyy6'><fieldset id='wuyy6'></fieldset></dl></div>
      3. 如何打开然后关闭窗口而不会被阻止为弹出窗口?

        How to open and then close a window without getting blocked as a popup?(如何打开然后关闭窗口而不会被阻止为弹出窗口?)

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

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

                1. <tfoot id='NSIhf'></tfoot>
                  本文介绍了如何打开然后关闭窗口而不会被阻止为弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想指导电子商务网站中的客户通过 Paypal 的网站付款.我希望在新标签/窗口中完成付款,这样客户就不会丢失他/她所在网页的当前状态.

                  I want to direct a customer in an e-commerce site to pay via Paypal's website. I would like the payment to be done in a new tab/window so the customer doesn't lose the current state of the web page he/she is at.

                  为了让 Paypal 窗口打开而不会被阻止,我使用了 target="_blank" 的锚点.除了以下事实外,它工作得很好,因为 window.close() 不适用于未通过 window.open 打开的窗口,所以在 Paypal 付款完成后我无法关闭它().

                  In order for the Paypal window to open without getting blocked, I am using an anchor with target="_blank". Which is working perfectly except for the fact, I can't close it after Paypal payment is done since window.close() doesn't work for windows that were not opened via window.open().

                  我怎样才能使它既不被阻止为弹出窗口,又可以在以后用 JS 关闭它?

                  How do I make it so it is BOTH not blocked as a popup AND I am able to close it with JS later on?

                  推荐答案

                  为了让 Paypal 窗口在不被阻止的情况下打开,我使用了 target="_blank" 的锚点.

                  In order for the Paypal window to open without getting blocked, I am using an anchor with target="_blank".

                  这是一种选择,但只要您在处理程序中为用户生成的事件(如 click)调用 window.open,就可以打开 pop-上窗户.因此,只需确保从链接上的 click 处理程序中调用 window.open (然后您可以关闭它).现代弹出式窗口拦截器(过去几年的任何内容)会阻止不是由用户事件触发的弹出式窗口,但允许由用户事件触发的弹出式窗口.

                  That's one option, but as long as you call window.open from within the handler for a user-generated event (like click), you can open pop-up windows. So just make sure you call window.open from within a click handler on the link (and then you can close it). Modern pop-up blockers (anything from the last several years) block pop-ups that aren't triggered by a user event, but allow ones that are.

                  实例 |来源:

                  HTML:

                  <p><a href="#" id="target">Click to open popup</a>; it will close automatically after five seconds.</p>
                  

                  JavaScript:

                  JavaScript:

                  (function() {
                  
                    document.getElementById("target").onclick = function() {
                      var wnd = window.open("http://stackoverflow.com");
                      setTimeout(function() {
                        wnd.close();
                      }, 5000);
                      return false;
                    };
                  
                  })();
                  

                  这篇关于如何打开然后关闭窗口而不会被阻止为弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在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中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                  • <tfoot id='mw2CH'></tfoot>

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

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

                        • <legend id='mw2CH'><style id='mw2CH'><dir id='mw2CH'><q id='mw2CH'></q></dir></style></legend>