![]() Internet Explorer (up to version 8) used an alternate attachEvent method. GBrowser.- a/browser/base/content/test/general/browser_unloaddialogs.js +++ b/browser/base/content/test/general/browser_unloaddialogs.js -23,51 +23,19 var testUrls = "(evt. gBrowser) + return + const tabContainer + t(domWindow, + helper.addEventListener(tabContainer. links: PTS, VCS area: main in suites: wheezy size: 796,452 kB sloc: cpp: 3,181,607 ansic: 1,641,175 python: 167,590 java: 128,022. addEventListener is the proper DOM method to use for attaching event handlers. If your code does not have access to the main window because it is run in a sidebar or dialog, you first need to get access to the browser window you need before you can use gBrowser. It means support to removeEventListener too, the capture phase of DOM event dispatch, and stopPropagation & preventDefault event methods as well. If you need to do something with gBrowserright after the window is opened, listenfor the loadevent and use gBrowserin the event listener. ![]() Which means it only works from an extension you canât use this in a web page. It also shows you how to attach event listeners to injected elements and elements that were already in the webpage. When a page matching a certain host name is found it will inject into it. The catch is that itâs Firefox-internal only. ff-addon-template-BootstrapWatchHostEventListener - Uses event listener (DOMContentLoaded) to watch page loads in all tabs and windows with gBrowser. Note You can restart the browser with the command Ctrl + Alt + R (Windows, Linux) or Cmd + Alt + R (Mac) This command restarts the browser with the same tabs open as before the restart. gBrowser.addEventListener (DOMContentLoaded, thefunctionname, true) This is a very reliable way of knowing when the browser has loaded only the page. ![]() Refactor code so all content/DOM access is grouped in a single object or file. It adds a listener to the currently selected tabâs load event that will eat the new page, then loads a new page. First you wait for the browser top window to actually initialize ( window.addEventListener ). ![]() It was Introduced in the DOM L-2 Events specifications. Here is a technique for writing an add-on that works in both Electrolysis and non-Electrolysis browsers (e.g. Open_manager("addons://list/extension", function(aManager), aManager) The API for adding DOM event handlers modern standard. Side-note: If you really wanted to catch all events on a XUL document you should register an event listener on document or document.documentElement. Bug 656269 - Add link to Mozilla plugin check from Add-ons ManagerĬonst MAIN_URL = "" + RELATIVE_DIR + "discovery.html" Ĭonst PREF_PLUGINCHECKURL = "" Im trying to listen to custom event peakAhBoo so I add the event listener to gBrowser and if no gBrowser is present then I add it to aDOMWindow ( gist ). What you probably mean is attaching an event listener to the element where the web pages are loaded: gBrowser.addEventListener (.).* Any copyright is dedicated to the Public Domain.
0 Comments
Leave a Reply. |