-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
navigator.languages
returns an empty array
#11053
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines. |
Okay, so you can set the To obtain actual user locale settings during preload, use Object.defineProperty(navigator, 'languages', {
value: ["en-US", "zh-CN", "ja-JP"],
configurable: true
}); |
Yep, that's a legit bug (or at least a documentation issue). |
Hi i'm kinda stuck on this issue, i have implemented skype is there any work around to set default value for main issue is the skype sdk loaded by an iframe injected by the sdk, so even i set it in my page, it will no work. Thanks in advance. |
@melvin-clickprofits Did you try the solution I propose above? It works for me. If you need to set Object.defineProperty(document.querySelector("#iframeId").contentWindow.navigator, 'languages', {
value: ["en-US", "zh-CN", "ja-JP"], // or whatever you want
configurable: true
}); And of course, you'd need to set the iframe navigator on its parent page, not during BrowserWindow preload. |
@kysely tested it works, ju Thanks 👍, just have to make sure the iframe is already inserted |
Hi, I'd love to tackle this if no one is working on it. |
I'm working on it currently. |
@ckerr, can this issue be closed? I see PR merged. |
Looks fixed to me! |
Expected behavior
navigator.languages
should return array of user's preferred languages, e.g.["en-US", "zh-CN", "ja-JP"]
Actual behavior
navigator.languages
returns an empty array[]
How to reproduce
Create a primitive HTML file that logs
navigator.languages
into console. Then try loading viafile://
,http
and inside Electron'srenderer
process. The first two will give you actual results whilerenderer
yields empty array.The text was updated successfully, but these errors were encountered: