Google Chrome memory saver – command line switch?

如何手動啟用chrome 瀏覽器「Memory Saver」, 解法:
https://stackoverflow.com/questions/76938654/google-chrome-memory-saver-command-line-switch

The setting seems to be here: "C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Local State"

{
    "autofill": {
        "states_data_dir": "C:\\Users\\<username>\\AppData\\Local\\Google\\Chrome\\User Data\\AutofillStates\20.11.2.164946"
    },
    "background_mode": {
        "enabled": false
    },
    "browser": {
        "enabled_labs_experiments": [
            "memory-saver-multi-state-mode@1"
        ],
        "has_shown_refresh_2023_whats_new": true,
        "last_redirect_origin": "",
        "last_whats_new_version": 119,
        "shortcut_migration_version": "86.0.4240.75"
    },
    "data_use_measurement": {
        "data_used": {
            "services": {
                "background": {},
                "foreground": {}
.....

With the setting on Default it shows: "browser":{"enabled_labs_experiments":[]

Enabled shows: "enabled_labs_experiments": ["memory-saver-multi-state-mode@1"]


寫入 Local Data 的範例程式碼:

def nodriver_overwrite_prefs(conf):
    state_filepath = os.path.join(conf.user_data_dir,"Local State")
    state_dict = {}
    state_dict["performance_tuning"]={}
    state_dict["performance_tuning"]["high_efficiency_mode"]={}
    state_dict["performance_tuning"]["high_efficiency_mode"]["state"]=1
    state_dict["browser"]={}
    state_dict["browser"]["enabled_labs_experiments"]=[
        "memory-saver-multi-state-mode@1",
        "modal-memory-saver@1"
    ]
    json_str = json.dumps(state_dict)
    with open(state_filepath, 'w') as outfile:
        outfile.write(json_str)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *