<bdo id='uFU07'></bdo><ul id='uFU07'></ul>
    1. <tfoot id='uFU07'></tfoot>

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

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

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

      1. 在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?

        In Google Chrome, how do I bring an existing popup window to the front using javascript from the parent window?(在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?)

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

          <tbody id='K3os1'></tbody>
          <bdo id='K3os1'></bdo><ul id='K3os1'></ul>

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

                  本文介绍了在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在网页上有一个具有以下行为的按钮:

                  I would like to have a button on a web page with the following behavior:

                  • 第一次点击时,打开一个弹出窗口.
                  • 在以后的点击中,如果弹出窗口仍然打开,只需将其带到前面即可.如果没有,请重新打开.

                  以下代码适用于 Firefox(Mac 和 Windows)、Safari(Mac 和 Windows)和 IE8.(我还没有测试过 IE6 或 IE7.)但是,在 Google Chrome(Mac 和 Windows)中,稍后单击无法将现有的弹出窗口按需要置于最前面.

                  The below code works in Firefox (Mac & Windows), Safari (Mac & Windows), and IE8. (I have not yet tested IE6 or IE7.) However, in Google Chrome (both Mac & Windows) later clicks fail to bring the existing pop-up to the front as desired.

                  如何在 Chrome 中进行这项工作?

                  How can I make this work in Chrome?

                  <head>
                    <script type="text/javascript">
                      var popupWindow = null;
                      var doPopup = function () {
                        if (popupWindow && !popupWindow.closed) {
                          popupWindow.focus();
                        } else {
                          popupWindow = window.open("http://google.com", "_blank",
                            "width=200,height=200");
                        }
                      };
                    </script>
                  </head>
                  
                  <body>
                    <button onclick="doPopup(); return false">
                      create a pop-up
                    </button>
                  </body>
                  

                  背景:我正在重新询问 this question 专门针对 Google Chrome,因为我认为我的代码至少解决了其他现代浏览器和 IE8 的问题.如果有这样做的首选礼仪,请告诉我.

                  Background: I am re-asking this question specifically for Google Chrome, as I think I my code solves the problem at least for other modern browsers and IE8. If there is a preferred etiquette for doing so, please let me know.

                  推荐答案

                  你不能.出于安全原因,Chrome 中禁用了 Window.focus,这不太可能改变.

                  You can't. Window.focus is disabled in Chrome for security reasons, and that is unlikely to change.

                  您必须关闭并重新打开相应的窗口.

                  You have to close and repopen the respective window.

                  这篇关于在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                  Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                  Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                  How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                  Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                  Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))
                • <tfoot id='yk83J'></tfoot>
                    <tbody id='yk83J'></tbody>

                  1. <small id='yk83J'></small><noframes id='yk83J'>

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