首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >审计navigator.userAgent、navigator.appVersion和navigator.platform的使用

审计navigator.userAgent、navigator.appVersion和navigator.platform的使用
EN

Stack Overflow用户
提问于 2021-09-26 14:09:44
回答 1查看 4.8K关注 0票数 1

我正在使用Microsoft.AspNetCore.App 5开发一个Blazor服务器端web应用程序,我遇到了以下错误:

代码语言:javascript
运行
复制
Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform
A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. In a future version of Chrome, the amount of information available in the User Agent string will be reduced.
To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData.
Note that for performance reasons, only the first access to one of the properties is shown.
1 source
blazor.server.js:1

重现此错误的最小代码:myshop.zip

我还没有添加任何关于导航器的特定代码。我怎么能解决这个问题?

我在Blazor网站上看到了一个错误:

在Chrome浏览器开发工具中,我看到:

EN

回答 1

Stack Overflow用户

发布于 2021-09-28 15:49:25

Chrome所反对的是使用导航功能的库。

https://blog.chromium.org/2021/05/update-on-user-agent-string-reduction.html

下面是这篇博客的一些引语:

从M92开始,我们计划在DevTools getters选项卡中为navigator.userAgent、navigator.appVersion和navigator.platform getter发送弃用通知。如果您的站点、服务、库或应用程序依赖于用户代理字符串中的某些信息,如Chrome小版本、OS版本号或Android设备模型,则需要开始迁移才能使用用户代理客户端提示API。

因此,您没有使用导航器getter,但是库确实在使用,但是您似乎只能等待对库的.js进行更新,以消除警告。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69335733

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档