Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set browser preferences correctly #308

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Conversation

Junyan
Copy link
Contributor

@Junyan Junyan commented Jul 18, 2023

@Junyan Junyan force-pushed the patch-2 branch 3 times, most recently from dcc4601 to cdc8cb9 Compare July 18, 2023 08:07
@paulirish
Copy link
Member

@Junyan FYI #247 (comment)

have you used the pref file? (we haven't)

@Junyan
Copy link
Contributor Author

Junyan commented Aug 8, 2023

@paulirish

create a temporary Chrome data directory and create a 'Preferences' file

mktemp -d
# return /var/folders/15/d7cwhpnj6r939vbh_6tch9dc0000gp/T/tmp.LzAXgbHU

mkdir /var/folders/15/d7cwhpnj6r939vbh_6tch9dc0000gp/T/tmp.LzAXgbHU/Default

echo '{"intl":{"selected_languages":"zh-CN,zh,zh-HK,en"}}' > /var/folders/15/d7cwhpnj6r939vbh_6tch9dc0000gp/T/tmp.LzAXgbHU/Default/Preferences

open Chrome

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/var/folders/15/d7cwhpnj6r939vbh_6tch9dc0000gp/T/tmp.LzAXgbHU

enter the script in the Chrome Console panel

console.log(window.navigator.languages)
// return ['zh-CN', 'zh', 'zh-HK', 'en']

@paulirish
Copy link
Member

Yeah this does seem to work! :)

@paulirish paulirish merged commit fccf4e8 into GoogleChrome:main Aug 30, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants