简体   繁体   English

使用 window.navigator 时显示的用户代理不正确 - 与 http 标头不匹配

[英]Incorrect user-agent displayed when using window.navigator - does not match http header

I switch user-agent using the chrome extention and here is the user-agent string in the http header:我使用 chrome 扩展切换用户代理,这是 http 标头中的用户代理字符串: 在此处输入图像描述

Here is a console log of the window.navigator.userAgent.这是 window.navigator.userAgent 的控制台日志。 why aren't they the same?为什么他们不一样? How can I programmatically get the userAgent shown in the http header in Javascript or Angular?如何以编程方式获取 Javascript 或 Angular 的 http 标头中显示的 userAgent? 在此处输入图像描述

Instead of using the "user-agent switcher for chrome" extention, I changed the " user agent " in the network conditions tab in the chrome inspector.我没有使用“用于 chrome 的用户代理切换器”扩展,而是在 chrome 检查器的网络条件选项卡中更改了“用户代理”。 that worked: https://developer.chrome.com/docs/devtools/device-mode/override-user-agent/有效: https ://developer.chrome.com/docs/devtools/device-mode/override-user-agent/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM