首页 > 解决方案 > 如何使用 SCRIPT SRC 打开新标签页

问题描述

我正在尝试将付款按钮添加到我的网页(wix)。单击时,它会像小部件一样在同一个 iframe 中打开,但我希望它在单击时在新选项卡中打开。target="_blank"不起作用。

示例代码:

<html>
<body>
<script src="https://www.example.com./integrations/v1/web-payment-checkout.js"
data-preference-id="example" data-source="button">
</script>
</body>
</html>

标签: htmlsrc

解决方案


使用 Bootstrap,您可以使用像button这样的锚点


或使用样式自定义链接,使其看起来像一个按钮


并使用 target="_blank" 在新选项卡中打开链接。

<html>
    <head>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    </head>
    <body>
        <br>
        

        <a class="btn btn-success" href="https://www.google.com" target="_blank">open google in new tab</a>

    </body>
</html>



推荐阅读