【问题标题】:New HTML opens in current electron window instead of a new window [closed]新 HTML 在当前电子窗口中打开而不是新窗口 [关闭]
【发布时间】:2021-02-20 20:18:56
【问题描述】:
<html>
    <head>
        <title></title>
    </head>
    <input type="button" name="new" id="newmon" value="new">

<button onclick="open1()">monitor 1</button>


<script>

        function open1() {
        monitor1 = window.open('https://discord.com/login?redirect_to=%2Fchannels%2F%40me','github','width=200, height=800');
        }
</script>


<button onclick="open2()">monitor 2</button>
<script>
    function open2() {
    monitor2 = window.open('./monitorTwo.html','github','width=400, height=800');
    }
</script>
    <body>
        

    
    </body>
    
</html>


问题:当我按下第二个按钮打开第二个新窗口时,它只是在旧窗口中打开第二个 HTML,而不是打开它自己的。

【问题讨论】:

    标签: javascript html node.js electron


    【解决方案1】:

    两个调用都使用相同的窗口名称'github'window.open() 的第二个参数)。这指示浏览器重用同一个窗口。更改名称,使两者不使用相同的名称,它将打开一个新窗口。您可以阅读有关主题 here on MDN 的一些文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-29
      • 1970-01-01
      • 1970-01-01
      • 2022-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多