问题
I want to achieve this
- Anchor a panel to a widget
- make it persist
- It will only appear or disappear when widget is clicked
- or It may be made to disappear by clicking some button on it I want to achieve this because my addon is entirely residing in a panel Here is the addon.
回答1:
Ok, I looked at this a bit more, and I'd like to apologize for a couple of things:
- iframe won't work due to cross-domain security issues. That was a dead end.
- I took waaay too long to get back to you, I've been on holiday and the place we were staying at only allowed 30 minutes of wifi per day, per room.
One way to approach this is to load your html directly from the data folder, pass it into the content script and inject it into the page. Something like this:
https://builder.addons.mozilla.org/addon/1043886/latest/
Some usability guidelines for this:
- the user should be able to easily and obviously remove the injected content from the page. If you need to preserve the state of the injected content, you'll need to store that before removing the DOM nodes.
- the injection should probably only happen when the user makes an action, eg by clicking on a widget. This should at least be the default.
- there should be very careful handling of any data that gets sent back to the main.js add-on code from the injected content, as per usual. DO NOT TRUST DATA FROM THE WEB!
回答2:
You mean "noautohide" panel property?
It seems you cannot access to Panel object using the addon SDK, so you can create your own XUL Panel to set noautohide=true.
来源:https://stackoverflow.com/questions/9328471/making-a-panel-persist-despite-click-on-page-opened-in-browser