[英]Changing HTTP request headers (user agent) - Chrome/Firefox
I've googled, but I couldn't find anything. 我用谷歌搜索,但我找不到任何东西。 What would be the best way to change/spoof user agent with a Chrome/Firefox extension.
使用Chrome / Firefox扩展程序更改/欺骗用户代理的最佳方法是什么?
Yes, I know the way to do it with config, but this isn't the perfect way. 是的,我知道用config做的方法,但这不是完美的方式。 Is there a way to stop request being sent, replace header and send it?
有没有办法停止发送请求,替换标头并发送它?
In Firefox, set general.useragent.override
in about:config
(make sure it's of type "string") or (without Firefox running) your profile's "prefs.js" file to the desired string. 在Firefox中,在
about:config
设置general.useragent.override
(确保它的类型为“string”)或者(不运行Firefox)将配置文件的“prefs.js”文件设置为所需的字符串。 A blank string results in no user-agent header being sent. 空白字符串不会导致发送用户代理标头。
In Chrome or Chromium, run the program with the argument --user-agent="STRING"
. 在Chrome或Chromium中,使用参数
--user-agent="STRING"
运行程序。 A blank string results in a blank user-agent header being sent. 空白字符串会导致发送空白用户代理标头。
Note that in neither case does this mask the bits of the user-agent observable from Javascript, like navigator.userAgent
or navigator.vendor
. 请注意,在这两种情况下都不会屏蔽来自Javascript的user-agent observable的位,例如
navigator.userAgent
或navigator.vendor
。 Some Firefox extensions do change some of these; 一些Firefox扩展确实改变了其中一些; I think "User-Agent Switcher" and "TorButton" have code to do so.
我认为“User-Agent Switcher”和“TorButton”都有代码可以这样做。 Others do not, like UAControl.
其他人不像UAControl那样。 I don't know if Chrome exposes an API to its extensions for to mask those values.
我不知道Chrome是否会向其扩展程序公开API以屏蔽这些值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.