我正在使用Microsoft.AspNetCore.App 5开发一个Blazor服务器端web应用程序,我遇到了以下错误:
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浏览器开发工具中,我看到:
发布于 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
进行更新,以消除警告。
https://stackoverflow.com/questions/69335733
复制相似问题