Can we use a Global variable that persists over multiple instances of the browser (FF)? I am building a ff extension which has to take the host& port name from the user once and then execute the menu options accordingly using that very host and port. This Host and port must remain same untill the user resets it (for which an option will be given) On declaring the variable as global in the JS file, it would become null everytime the browser is restarted. Can anyone help me out with how and where to save this variable to get the desired functionality. Heres the code to set the preferences. but doesnt work for me function setInstance(){
if (pref_manager.prefHasUserValue("myvar"))
{ getString = pref_manager.getString("myvar");
instance = getString;
} if(instance == null){
instance = prompt("Please enter webcenter host and port");
// Setting the values
pref_manager.setString("myvar", instance);
pref_manager.setIntPref("myintvar", 1);
}
}
This function is called as soon as the extension menu option is opened. instance is a global variable which i need to be inputed by the user only once till reset