I am creating a Firefox extension that requires the user to login. Each time a new window, but not new tab is opened, the ‘code’ for the extension is run. I would prefer that the code is only run one time per session.
The setup of the extension looks like this. (let me know if I am missing anything):
in chrome manifest:
overlay chrome://browser/content/browser.xul chrome://my/overlay.xul
in overlay.xul:
<overlay id="socialSidebarOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://my/code.js" />
</overlay>
in code.js:
alert('being called')
The problem is that “being called” should only be displayed when Firefox starts up, not when new tabs or windows are opened. What would be a way to accomplish this?
You can use a JavaScript code module to make sure your code is only executed once.