为了账号安全,请及时绑定邮箱和手机立即绑定

摆脱执行 imacros 脚本时打开的第二页

摆脱执行 imacros 脚本时打开的第二页

湖上湖 2022-08-18 15:51:25
我如何摆脱使用此href执行imacros脚本时打开的第二个页面第一个选项卡是一个简单的 html 页面,其中包含以下标记:<a target="blank"   href="javascript:window.open('imacros://run/?m=#current.js');">    <button>Run macro</button></a>单击此链接时,将打开第二个选项卡,其中包含图像中的内容以及我要删除的选项卡。第三页包含我要执行的内容。注意:我想让第一页保持打开状态。
查看完整描述

2 回答

?
红颜莎娜

TA贡献1842条经验 获得超13个赞

试试这个。如果它有效,它比使用javascript hrefs和链接中的包装按钮更好


您可以使用按钮而不是链接


window.addEventListener("load",function() {

  document.querySelector("#imacro").addEventListener("click",function(e) {

    e.preventDefault();

    window.open(this.dataset.href)

  })

})

.button {

    display: block;

    width: 100px;

    height: 20px;

    padding: 10px;

    text-align: center;

    border-radius: 5px;

    border:1px solid black;

    font-weight: bold;

    text-decoration: none;

}

<a href="#" class="button" id="imacro"

  data-href="imacros://run/?m=#current.js">

   Run macro

</a>


查看完整回答
反对 回复 2022-08-18
?
MMMHUHU

TA贡献1834条经验 获得超8个赞

无法测试这个,但我会尝试:


    <a

      href="#"

      onclick="javascript:window.open('imacros://run/?m=#current.js');return false;"

    >

      <button>Run macro</button>

    </a>


查看完整回答
反对 回复 2022-08-18
  • 2 回答
  • 0 关注
  • 140 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号