Thursday, September 4, 2008

How to change "about:config" in firebox,netscape,google chrome Using Javascript

If you want to change about:config through javascript here is examble,

var browserName=navigator.appName; 
var browserVer=parseInt(navigator.appVersion);
var popsMode;
if (browserName=="Netscape" && browserVer>=5) {
    alert(browserName);
    alert(browserVer);
    popsMode=true;
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
      if (prefs.getPrefType("dom.disable_window_open_feature.resizable") == prefs.PREF_BOOL){
        popsMode = prefs.getBoolPref("dom.disable_window_open_feature.resizable");
      }
   if (popsMode==true) {
   prefs.setBoolPref("dom.disable_window_open_feature.resizable",false);
   alert(popsMode);
   }
 }

2 comments:

Umesh.chape said...

When i run this code as a function on page load.
Following line is not executing and java script is not running

netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

How can i run complete java script.

Vinoth said...

It supported in Mozilla and netscape browser only.


netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");