在 HTTP 请求中定义自定义用户代理标头?
我想了解一下为 iPhone 设备创建的网站。为了能够查看这些站点,我必须修改浏览器发送的 HTTP 请求中的用户代理标头。这样我就可以欺骗网络服务器,让其相信我的浏览器是 iPhone 浏览器,然后网络服务器就会向我发送 iPhone 版本的网站。
那么,如何修改浏览器在每个 HTTP 请求中发送的 User-agent 标头。 也许有一个 Firefox 插件允许修改请求标头? 另外,我想我听说 Safari 允许这样做......
I would like to get a glimpse of web-sites created for iPhone devices. In order to be able to view those sites I have to modify the User-agent header in the HTTP request that my browser sends. That way I can trick the web-server into believing that my browser is an iPhone browser, and then the web-server would send my the iPhone version of the web-site.
So, how can I modify the User-agent header that my browser sends in each HTTP request.
Maybe there is an Firefox plug-in that allows modifying request headers?
Also, I think I heard that Safari allows that somehow....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您不需要浏览器插件即可在 HTTP 标头中添加自定义用户代理字符串。 Chrome 已将此功能添加到开发者工具中。
打开开发者工具,然后单击
Toggle Device Toolbar
选项或按cmd+shift+M
将其打开。您可以从预设中选择设备用户代理,也可以定义自定义设备,如下面的屏幕截图中所述。You don't need a browser add-on in order to add a custom User-Agent string in your HTTP header. Chrome has added this feature to developer tools.
Open the developer tools and click on the
Toggle Device Toolbar
option or presscmd+shift+M
to open it. You can select a device user agent from the presets or you can also define a custom device like mentioned in the below screenshot.首先,有以下插件: https://addons.mozilla.org/ en-US/firefox/addon/59/
另外,还有 Firefox 配置:在 Firefox 中输入“about:config”作为 URL,在那里找到 generic.useragent.* 属性。
First, there's the following plugin: https://addons.mozilla.org/en-US/firefox/addon/59/
Also, there's Firefox configuration: type "about:config" as URL in Firefox, find general.useragent.* properties there.
是的,您可以使用 Firefox 的 修改标题 插件来完成此操作。
Yeah you can do this with Modify Headers add-on for Firefox.
您可以尝试用户代理切换器插件。
You can try the user-agent switcher plugin.