Daniel J F
Daniel J F

Reputation: 1064

How to open a panel with Javascript?

I have this code:

<?xul-overlay href="chrome://myextention/popup.xul"?>

<toolbarbutton id="button" type="menu">
    <panel id="popup" />
</toolbarbutton>

When I click the button it opens the popup panel. Now I want to open the same panel when I click an element in another window. I'm getting the current browser with navigator:browser, finding the panel ( e.g. panel.state works ) and trying to open it but it doesn't work.

I've tried openPopup, open = true and openPopupAtScreen - none of this works. Any ideas?

Upvotes: 0

Views: 1053

Answers (1)

Mike Kaply
Mike Kaply

Reputation: 745

openPopup is definitely the correct way to open the panel.

I believe the problem is that you've made the panel child of the toolbarbutton.

I would suggest making the panel a separate item in the XUL (a child of mainPopupSet).

Then use openPopup in both cases.

Upvotes: 2

Related Questions