如何使用 javascript 启用 google chrome chrome://flags/ 值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18951644/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to enable google chrome chrome://flags/ values using javascript?
提问by Panchotiya Vipul
I want to enable google chrome flags enable using JavaScript.If flags enable then no action require, if disable then make it enable .
我想使用 JavaScript 启用 google chrome 标志启用。如果标志启用则不需要任何操作,如果禁用则使其启用。
回答by Satyam Koyani
local statefile contains setting of flags(This is text file in json format)
本地状态文件包含标志设置(这是 json 格式的文本文件)
Chrome user directory location
"browser": {
"enabled_labs_experiments": [ "load-cloud-policy-on-signin", "old-checkbox-style" ],
"last_redirect_origin": ""
}
"enabled_labs_experiments"attribute contains value of such flags which user enabled manually.In your case you have to first check your preferred flag entry is available or not if not then you have to add your flag in this file by javascript.
“enabled_labs_experiments”属性包含用户手动启用的此类标志的值。在您的情况下,您必须首先检查您的首选标志条目是否可用,否则您必须通过javascript在此文件中添加您的标志。
Using javascript you can read and edit text files so read that file from specified location as per operating system and edit that file.
使用 javascript,您可以读取和编辑文本文件,以便根据操作系统从指定位置读取该文件并编辑该文件。
回答by Uooo
Changing browser settings and options using Javascript is not possible. This can only be controlled by the user.
无法使用 Javascript 更改浏览器设置和选项。这只能由用户控制。
However, Chrome's experimental flags can be accessed using direct links. But note that
但是,可以使用直接链接访问 Chrome 的实验性标志。但请注意
The feature is currently available in Chrome Canary, and maybe also in Chrome Dev. It may take a while before it makes its way to other versions of the browser.
该功能目前在 Chrome Canary 中可用,也可能在 Chrome Dev 中可用。它可能需要一段时间才能进入其他版本的浏览器。
Once it is available, you can use a link like this in your webpage to make it more convenient for the user to find the right setting:
一旦可用,您可以在您的网页中使用这样的链接,以便用户更方便地找到正确的设置:
<a href="chrome://flags/#disable-webrtc" target="_blank">Enable WEBRTC</a>