我不确定如何在 SDK 中执行此操作。
但是您要做的是添加一个 TabSelect 事件侦听器。
这就是它在引导程序或覆盖插件中的完成方式。
function exampleTabSelected(event) {
//tab was selected
var tab = event.target; //this tab is the actual thingy you click in the tab bar at top
var tabBrowser = tab.linkedBrowser; //this is the chrome browser within this tab
var tabContentWindow = tabBrowser.contentWindow; //this is the HTML (or whatever type) contained inside the tab, this is where your website is
var siteLocationObj = tabContentWindow.location;
//location now includes properties like href, host, pathname, hash, and port
//now put your the id of your id of the panel and you can do whatever to it
var chromeWindow = tab.ownerGlobal; //this is the firefox browser window that the tab is in
chromeWindow.document.getElementById('YOUR-PANEL-ID-HERE').querySelector('iframe').contentDocument.innerHTML = 'you are now on page: ' siteLocationObj.href;
}
// During initialisation
var container = gBrowser.tabContainer;
container.addEventListener("TabSelect", exampleTabSelected, false);
// When no longer needed
//container.removeEventListener("TabSelect", exampleTabSelected, false);