Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i change about:config in mozilla via javascript?

Hello I am developing a HTML 5 game and in Chrome the animations looks great but in firefox not! I was searching over the internet and i found a solution that i need to change some settings in about:config and they are:

webgl.force-enabled=true
webgl.msaa-force=true
layers.acceleration.force-enabled=true
gfx.direct2d.force-enabled=true
stagefright.force-enabled=true

I change those setting manually and the animations looks great in Firefox. Now my question is how can I do that using javascript? Is it possible?

like image 766
liquid boy Avatar asked Dec 17 '12 13:12

liquid boy


2 Answers

A discussion in the MozillaZine forum suggests creating a bookmarklet as follows (instructions and code copied from there):

  1. Make a file in your Firefox installation folder, under the res directory, called for example 'proxy.htm', and put this in it:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
       <title>Proxy Toggle</title>
       <script type="text/javascript">
       // <![CDATA[
       function loaded() { 
          netscape.security.PrivilegeManager
          .enablePrivilege("UniversalBrowserAccess UniversalXPConnect");
          var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                      .getService(Components.interfaces.nsIPrefBranch);
          if (prefs.getIntPref("network.proxy.type") == 0) {
             prefs.setIntPref("network.proxy.type", 1);
          }
          else {
             prefs.setIntPref("network.proxy.type", 0); 
          }
          self.close();
       }; 
       self.onload = loaded;   
       // ]]>
       </script>
    </head>
    <body>
       Please wait...
    </body>
    </html>
    
  2. Then make a bookmarklet to toggle the state of the proxy pref, and put this as the location:

    javascript: void(window.open('resource:///res/proxy.htm'));
    

See: http://forums.mozillazine.org/viewtopic.php?f=7&t=87755

like image 78
Pavel Hodek Avatar answered Oct 25 '22 04:10

Pavel Hodek


You should not change these settings - not on your computer and especially not on computers of other people. These settings will be enabled anyway, assuming that the hardware and drivers are capable of handling them. The force-enabled settings are for testing only, switching them on is likely to cause instability (Firefox crashes, graphics driver crashes).

Most likely reason why Firefox didn't enable hardware acceleration automatically in your case are outdated drivers - you should install current drivers for your graphics card and recommend other people to do the same.

like image 38
Wladimir Palant Avatar answered Oct 25 '22 06:10

Wladimir Palant