0

How do I listen for a tab open event in fennec? The gBrowser object doesn't exist and the closest thing to it I could find was the Browser object, but it doesn't let me attach listeners to it.

tmim
  • 12,091
  • 4
  • 18
  • 12

1 Answers1

1

from https://wiki.mozilla.org/Mobile/Fennec/CodeSnippets The Browser object fires a few Tab-specific events. You can use these events to monitor tab browser lifecycle: TabOpen, TabSelect, and TabClose. Here's an example of hooking up listeners for the events:

function startup() {
  let tabs = document.getElementById("tabs");
  tabs.addEventListener("TabOpen", onTabOpen, true);
}

function onTabOpen(event) {
  let newTab = event.originalTarget;
}
tmim
  • 12,091
  • 4
  • 18
  • 12