在同一窗口的新选项卡中打开链接
您好,我正在制作一个 Firefox 扩展,它需要在同一 Firefox 窗口的新选项卡中打开一个链接。我应该怎么做? 这将在新窗口中打开(替换旧窗口):
window.location = url;
这将在同一选项卡中打开
window.content.document.location = url
任何想法如何在新选项卡中打开网址?
Hi I am making a firefox extension which needs to open a link in anew tab in the same window of firefox. How should i do this?
This opens in a new window (replacing the old window):
window.location = url;
This opens in the same tab
window.content.document.location = url
Any idea on how to open the url in a new tab?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尝试过
window.open(url)
吗?我猜测专门在新选项卡(而不是新窗口)中打开是无法通过 JavaScript 控制的浏览器行为的一部分。Have you tried
window.open(url)
? I'm guessing opening specifically in a new tab (as opposed to a new window) is part of the browser behavior that can't be controlled via JavaScript.这行得通,伙计们! :))
This works guys! :))