Get your own customer support community
 

Catching load events of the main window from your sidebar.

Once you have created a sidebar xul, you want to listen to load events from the main window (to update the links in your sidebar).

Since we are not supposed to share code here is one conceptual way for achieving this:
1. add an event listener to your sidebar window object that listens to the load event (i.e. it will be triggered when you load the sidebar)
2. get a reference to the main window object as described in Link2 (see below)
3. here is the trick: within the function that handles the load event of your xul window, add an event listener to the appcontent element of the main window's document (not the xul window's document!) that listens to DOMContentLoaded and calls some function
4. once you have loaded the sidebar, that function will be called each time you switch to a new url in the main window
(5. you might want to remove the eventlistener from the appcontent once the sidebar is unloaded)

The following resources may help with this (thanks to Pat for the first one):
Link1: https://developer.mozilla.org/En/Code...
Link2: https://developer.mozilla.org/en/Work...
Inappropriate?
2 people like this idea

User_default_medium