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 navigator set error #2591

Merged
merged 2 commits into from Jun 13, 2019
Merged

fix navigator set error #2591

merged 2 commits into from Jun 13, 2019

Conversation

chenshuai2144
Copy link
Contributor

@chenshuai2144 chenshuai2144 commented Jun 12, 2019

错误的设置了navigator 的值。

社会地位👽 -1

@sorrycc
Copy link
Member

sorrycc commented Jun 12, 2019

window.navigator.language = lang; 是在哪些浏览器下有效?为啥我觉得是无效的。

@chenshuai2144
Copy link
Contributor Author

我人肉触发了一次。
image

如果用户从 window.navigator.language 拿信息还是能拿到的

@kuitos
Copy link
Member

kuitos commented Jun 12, 2019

navigator.language 不是 readonly 的么?https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language

@RaoHai
Copy link
Contributor

RaoHai commented Jun 12, 2019

https://html.spec.whatwg.org/multipage/window-object.html#window
https://html.spec.whatwg.org/multipage/system-state.html#language-preferences

image
不止 chrome ,从规范上来讲 window.navigator 就是 readonly 的, navigation.language 也是 readonly 的。

@wind928
Copy link

wind928 commented Jun 12, 2019

image
修改 window.navigator.language 也会报错

@chenshuai2144
Copy link
Contributor Author

那就是通过navigation.language 判断语言是不准的?

@coveralls
Copy link

coveralls commented Jun 13, 2019

Pull Request Test Coverage Report for Build 3995

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 35.518%

Totals Coverage Status
Change from base Build 3964: -0.01%
Covered Lines: 1455
Relevant Lines: 4095

💛 - Coveralls

@ghost
Copy link

ghost commented Jun 13, 2019

请问下如何修复这个问题呢?

@sorrycc sorrycc merged commit cbffdfb into master Jun 13, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix-navigator branch June 13, 2019 03:57
@sorrycc
Copy link
Member

sorrycc commented Jun 13, 2019

@yinbanghui 一会发个 bugfix 版,重装下依赖就好了。

@LewinJun
Copy link

我自己重写了 setLocal方法,去掉注释掉赋值的那行代码就好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants