4

Is there a way to programatically:

  1. Get chrome flags
  2. Set chrome flags

from an extension.

In this answer they mention a method that can be used inside chrome://flags tab. I was thinking maybe I can automatize that if Chrome permits it. But first, I want to check if the flag's value differs from my intended value, so a silent get method would be helpful.

Specifically, it's the Throttle expensive background timers flag:

chrome://flags/#expensive-background-timer-throttling

Another solution would be if I could disable throttling for a specific tab.

Granga
  • 1,612
  • 1
  • 14
  • 20
  • Possible duplicate of [Google Chrome - how can i programmatically enable chrome://flags some of the modules from disable mode to enabled mode?](https://stackoverflow.com/questions/17060363/google-chrome-how-can-i-programmatically-enable-chrome-flags-some-of-the-mod) – Sidney Oct 08 '17 at 19:08
  • It's partially a duplicate. The difference is that I also look for a way to `get` flag's value. I've also stated that in the question. – Granga Oct 08 '17 at 19:10
  • Why do you not launch Chrome with the specific flags set? Changing the flags while the instance is running where the flags were not set might not automatically set the the flags for that running instance. – guest271314 Oct 08 '17 at 19:19

1 Answers1

1

Launch the instance of Chrome, Chromium with the specific flags set. You can create several different launchers for the different setting that you want applied to the instance. Setting flags at an instance of running Chrome might not apply the set flags, even where a new instance of Chrome is launched with flags set pointing to the same configuration directory where the running instance of Chrome points. If the requirement is to launch multiple instances of Chrome with different flags set create a different configuration directory for each prospective instance, for example, using --user-data-dir flag set to the unique local directory used for each unique instance of Chrome or Chromium, see Read local XML with JS.

guest271314
  • 1
  • 15
  • 104
  • 177
  • 1
    That would work for development. I can't make extension's users to do it. That's why it needs to be as automatic as possible. – Granga Oct 08 '17 at 19:34
  • @Granga Not certain if it is possible to set flags during a running instance of Chrome or Chromium and have the flags applied immediately, ignoring the flags set or not set when the browser was launched; whether using and set within extension code or not. There is still the issue of the flags set or not when the browser is launched. – guest271314 Oct 08 '17 at 19:55
  • It's acceptable if restart is required. I will notify the user. But I doubt it's even possible to make such a change from extension as it is probably potentially dangerous. – Granga Oct 08 '17 at 20:01
  • 1
    @Granga Note, it should be possible use an open a new instance of Chrome from a running instance of Chrome using `NativeMessaging`. – guest271314 Oct 08 '17 at 20:02