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

探针代码在 Edge 浏览器报错 #207

Open
niceue opened this issue Nov 22, 2021 · 2 comments
Open

探针代码在 Edge 浏览器报错 #207

niceue opened this issue Nov 22, 2021 · 2 comments

Comments

@niceue
Copy link

niceue commented Nov 22, 2021

image
image

这些判断浏览器的代码正则后直接用索引 [0] 获取?这就很容易报错了。
正则很可能旧不匹配,结果为 null

@a597873885
Copy link
Owner

a597873885 commented Dec 4, 2021

@niceue 你好,此问题已修复了,请更新至 3.0.23版本

@niceue
Copy link
Author

niceue commented Jun 20, 2022

@a597873885 并没有修复。你可能是在 旧的 Edge 测试的,请升级到 Edge 102。

windows UA 为:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.124 Safari/537.36 Edg/102.0.1245.41

另外Edge在 Android、iOS 平台的UA也不一致,参考 https://docs.microsoft.com/en-us/microsoft-edge/web-platform/user-agent-guidance#user-agent-strings
image

所以最终修复代码:

h=p.match(/Edg(?:A|iOS)?\/(\d+)\.\d+/gi)[0];

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

No branches or pull requests

2 participants