最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - Can i change about:config in mozilla via javascript? - Stack Overflow

programmeradmin5浏览0评论

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?

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?

Share Improve this question edited Dec 17, 2012 at 14:28 Wladimir Palant 57.7k12 gold badges99 silver badges127 bronze badges asked Dec 17, 2012 at 13:26 liquid boyliquid boy 1751 silver badge7 bronze badges 9
  • 10 Hopefully not ! – John Dvorak Commented Dec 17, 2012 at 13:27
  • At least not from an arbitrary website. – Bergi Commented Dec 17, 2012 at 13:28
  • 3 Nope, would'nt that be great for all the webs delinquents if they could just change the browser settings as they pleased! – adeneo Commented Dec 17, 2012 at 13:29
  • 2 Why the down vote and vote to close? This is a legit question, written clearly with some research shown on the matter. It is a constructive question. While you may not want browsers to implement the behavior asked for, it's certainly a legit question. – tkone Commented Dec 17, 2012 at 13:34
  • 1 @tkone the meaning of my ment is: if there is a way for a website to modify about:config globally, then it's an enormous security threat. – John Dvorak Commented Dec 17, 2012 at 13:39
 |  Show 4 more ments

2 Answers 2

Reset to default 3

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/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3/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/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/viewtopic.php?f=7&t=87755

You should not change these settings - not on your puter and especially not on puters 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 remend other people to do the same.

发布评论

评论列表(0)

  1. 暂无评论