Question

In the Firefox extension I'm writing, I have a variable containing some data that I want to be able to access in both the actual extension and in the preferences pane of the extension. When Firefox is loaded, my extension code initializes the variable with the correct data. But, when I bring up my options dialog (which is contained in another XUL file) and try to use that same variable, the variable hasn't been initialized. Both of my extension XUL files are using the same JavaScript source file, but it looks like both XUL files are initializing new copies of the variable. How can I get that variable to be shared?

Thanks!

Was it helpful?

Solution

You will want to create a JavaScript code module. All the variables and methods inside of it are shared by all locations that include it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top