AlJo
AlJo

Reputation: 171

How to get/read a flag value in Chrome's about:flags?

How does one programmatically read the value of chrome://flags/#enable-panels with javascript from a chrome extension?

Upvotes: 2

Views: 3260

Answers (2)

Daniel Herr
Daniel Herr

Reputation: 20478

If you try to open a panel but the user does not have them enabled, it will just be show as a popup window. You can check for support like so:

chrome.windows.create({
  url:"panel.html", type:"panel", width: 400, height: 600
  }, function(window) {
    if (window.type === "panel") {
      console.log("Panels enabled.")
    } else {
      console.log("Panels disabled.")
      chrome.tabs.create({
        url:"chrome://flags/#enable-panels"
      }, function() {
        alert("Please enable panels.")
})  }  }  })

Upvotes: 1

user4565806
user4565806

Reputation:

The settings for all the flags are in the plain-txt file Local State in your User Data directory. For example:

C:\Users\FooUser\AppData\Local\Google\Chrome\User Data\Local State

You can then use XMLHttpRequest to get that file, like so:

xmlhttp.open("GET","file://C:/Users/FooUser/AppData/Local/Google/Chrome/User Data/Local State",false)
xmlhttp.send();
console.log(xmlhttp.response);

And you'll get something like this:

{
  …
  "browser": {
    "enabled_labs_experiments": [ "disable-gpu-vsync", "extension-apis", … ],
    …
  }
  …
}

Upvotes: -1

Related Questions