How to make the chrome app get the country parameter

54 views
Skip to first unread message

Silin Liu

unread,
Feb 8, 2021, 7:14:18 PM2/8/21
to Chromium-dev
Hi all,

When user setup Demo Mode there would be option to choose the language and the country. The code lines here. In javascript we can use navigator.language to get the current language. However, I don't find a way to get the country. Is there a way to pass the country parameter so that javascript or chrome app can get this info?

Thanks

172388847__31661128__812312.png

Demetrios Papadopoulos

unread,
Feb 9, 2021, 6:54:46 AM2/9/21
to sili...@google.com, Chromium-dev
> Is there a way to pass the country parameter so that javascript or chrome app can get this info?

Is this a WebUI page? If so, there are a lot of ways to pass data from C++ to JS (loadTimeData, ResolveJavacriptCallback, Mojo). I don't think a native JS API can give you the country (well, except the Geolocation API which would require the user giving permission).

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/4db5540e-dcba-49df-aa42-3b0417a77135n%40chromium.org.

Silin Liu

unread,
Feb 9, 2021, 6:22:08 PM2/9/21
to Demetrios Papadopoulos, Chromium-dev
I saw some examples of loadTimeData. It's sending the parameter to a specific WebUI. What I want to do is setting the "country" as a global variable in the session so all the apps can read it. Is that doable?
Reply all
Reply to author
Forward
0 new messages