在 HTTP 请求中定义自定义用户代理标头?

发布于 2024-09-19 20:28:26 字数 235 浏览 5 评论 0原文

我想了解一下为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

晨光如昨 2024-09-26 20:29:10

您不需要浏览器插件即可在 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 press cmd+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.

enter image description here

老子叫无熙 2024-09-26 20:29:01

首先,有以下插件: 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.

恍梦境° 2024-09-26 20:28:56

是的,您可以使用 Firefox 的 修改标题 插件来完成此操作。

Yeah you can do this with Modify Headers add-on for Firefox.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文