gpt4 book ai didi

javascript - 使用 Chrome Tabs API 单击按钮打开选项卡

转载 作者:行者123 更新时间:2023-12-03 07:42:00 28 4
gpt4 key购买 nike

有人对如何使用 Chrome 标签 API 在 google chrome 中打开新标签有任何建议吗?我一直在尝试在我的 Google Chrome 扩展程序中执行此操作,如下所示

<form>
Which page would you like to visit? <br />
<input type="text" id="channel" name="channel" placeholder="url">
<input type="button" value="button name" chrome.tabs.create="('#input from id="channel"')" />
</form>

但这似乎并不能解决问题。谁能看到我做错了什么吗? (忽略 id 部分的#input,我知道这行不通)。

提前致谢

最佳答案

如果您不必使用 Chrome 扩展程序

<input type="button" onclick="window.open(document.getElementById('channel').value,'_blank')" />

_blank 是在新选项卡上打开所需的参数。

关于javascript - 使用 Chrome Tabs API 单击按钮打开选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35372424/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com