Firefox preferences denote configuratiosn or some other information saved for Firefox. It can be accessed with URL (about:config) manually.
Steps to view preferences manually:
- Open firefox
- Enter ‘about:config’ in address bar
- Press Enter key
- Preferences table will be displayed
In some occasion, it is necessary to modify the preferences values by automatically.
var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
Now that you have access to the preference manager you can get and set preferences using getIntPref()/getBoolPref()/getCharPref() and setIntPref()/setBoolPref()/setCharPref(). These functions are very straight forward and have been used in the code samples above.
Following example shows to modify the default home page in Firefox
To get preference value:
var prefString = prefManager.getCharPref("browser.startup.homepage");
To set preferences value:
var prefString = prefManager.getCharPref("browser.startup.homepage", “https://dlak.wordpress.com”);