在Firefox扩展弹出窗口内的HTML文件之间切换?
我一直在试图将Chrome Extension移到Firefox上。大多数代码工作正常,除了这一件事。扩展弹出窗口具有 tab按钮顶部应该在不同的html文件之间切换(内部)弹出窗口)单击时。但是,当单击按钮时,扩展名只是冻结/崩溃。
这是“联系”选项卡按钮的代码的示例:
contactTab = document.getElementById("contact-tab")
contactTab.addEventListener("click", function() {
location = "contact.html"
})
在我使用location.href
的chrome版本中,它的工作正常,此问题仅在Firefox上。我已经尝试使用location.href
,位置
和window.location.location
,但是什么都没有。
如何在Firefox扩展弹出窗口中的HTML文件之间切换?
I've been trying to port my Chrome extension over to Firefox. Most of the code worked fine, except for this one thing. The extension popup has tab buttons at the top which are supposed to switch between different html files (inside the popup) when clicked. However, when the buttons are clicked, the extension simply freezes/crashes.
Here’s an example of the code for the "contact" tab button:
contactTab = document.getElementById("contact-tab")
contactTab.addEventListener("click", function() {
location = "contact.html"
})
In the Chrome version of my extension I used location.href
and it worked perfectly fine, this problem is only on Firefox. I’ve tried using location.href
, location
and window.location
, but nothing has worked.
How do I switch between html files in a Firefox extension popup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在JavaScript文件中添加
EventListener
,DO:html的路径基于root Directory。
Add an
eventListener
in your JavaScript file and do:Path to HTML is based on root directory.