尽管听起来很神秘,但浏览器用户代理实际上很容易理解。几乎每次您访问高流量网站时,其服务器都会考虑您当前的用户代理是什么,这有助于识别您的操作系统和浏览器(operating system and browser),以试图更好地向您提供内容。
即使是流行的浏览器(如Chrome、Firefox和Safari)在相互比较时也经常以不一致的方式显示 Web 内容。但是那里有数百个用户代理,从您可能从未听说过的浏览器到电子邮件和RSS阅读器。
在本文中,我们将讨论用户代理的技术方面以及如何利用软件和浏览器插件(software and browser plugins)来控制内容在网络上的显示方式。
浏览器用户代理切换器有什么作用?(What Does a Browser User-Agent Switcher Do?)
用户代理切换器就像它听起来的那样 - 它改变了
浏览器的用户代理。(user agent)用户代理是您的浏览器发送到与之通信的(user agent)Web 服务器(web server)的一串文本,它描述了用户的操作系统、浏览器、渲染引擎和其他重要细节。
例如,这是Windows 10上
最新版Google Chrome的用户代理:
Mozilla/5.0
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/77.0.3865.90 Safari/537.36
此信息通过HTTP标头传递给(HTTP)Web 服务器(web server),可用于更改内容的显示方式。浏览器通常以不同的方式呈现文本、图像和其他内容,因此Web 服务器(web server)
准确了解您正在浏览的内容以正确显示内容非常重要。
浏览器用户代理切换器允许您修改通过HTTP
标头发送的此字符串,以便Web 服务器(web server)认为您正在从与实际不同的浏览器浏览。
为什么要使用浏览器用户代理切换器?(Why Would You Want To Use a Browser User-Agent
Switcher?)
有几个原因可能会导致网站误以为他们正在从不同的浏览器进行浏览。
最常见的原因之一是Web 开发(web development)。虽然我坚信这里的最佳做法是简单地安装额外的浏览器以获得最真实的体验,但切换浏览器的用户代理将使您能够快速轻松地查看您的工作在其他浏览器中的样子。
浏览器用户代理切换可能有用的另一种情况是,当您尝试查看网站在移动设备上的显示方式时。也许您的连接速度较慢或受限,或者该网站具有可用于移动浏览器的其他功能或特性。(functionality or features)切换您的用户代理(user agent)可以实现这一点,而无需使用手机。
更改用户代理还可以帮助您绕过基于浏览器的限制。虽然它不像十年前那么普遍,但您有时会看到声称(claim incompatibility)与特定浏览器版本(browser build)不兼容的网站,
并且会完全拒绝任何使用它的人访问。您可以通过简单地更改用户代理来解决此问题。
最后但并非最不重要的一点是,考虑您的浏览隐私。虽然用户代理不会像IP 地址(IP address)那样在任何地方识别您,但您仍然放弃了浏览方式。但是,您应该被告知网站有一些方法可以超越用户代理字符串并识别您的浏览器。在安全的情况下,这并不是万无一失的。
如何获得浏览器用户代理切换器?(How Can You Get a Browser User-Agent Switcher?)
如今,大多数流行的浏览器都包含一个开发者控制台,它允许您更改各种内容,例如您的查看分辨率和用户代理(user agent)。问题在于,如果您打算经常更改用户代理(user agent),那么通过开发人员控制台完成这些步骤可能会很乏味。
因此,我们建议安装浏览器扩展程序(browser extension)或插件,以简化更改浏览器用户代理(browser user agent)的过程。Chrome 和 Firefox(Chrome and Firefox)
都为此目的提供了几个选项,但我们选择了最好的两个。
Chrome:Chrome的用户代理切换器(User-Agent Switcher for Chrome)(Chrome: User-Agent Switcher for Chrome)
这个
Chrome 扩展程序(Chrome extension)拥有近 200 万用户,由
Google开发,因此它与浏览器的兼容性应该是你所发现的一样好。
安装后,此扩展程序会在地址栏(address bar)右侧添加一个按钮,允许您通过总共八个浏览器和移动操作系统进行选择。选择一个后,您会看到它支持的几个浏览器版本。单击任何将更改您的用户代理(user agent)。
这个扩展的一个缺点是它目前支持的用户代理很少。例如,您的 iOS 选项仅限于iPhone 6和 iPad(它们不提供特定的一代)。
Firefox:用户代理切换器和管理器(User-Agent Switcher and Manager)(Firefox: User-Agent Switcher and Manager)
该插件已被Firefox 团队(Firefox team)推荐,拥有近 200,000 名用户。
User-Agent
Switcher and Manager比上面的Chrome 替代方案(Chrome alternative)更强大,它支持数十种额外的浏览器和操作系统,所有这些都提供了更多的用户代理。目前,有 738 个受支持的用户代理。
这个附加组件实际上将显示完整的用户代理字符串,而不仅仅是显示设备名称或浏览器版本。此外,您可以设置自定义用户代理。
如前所述,更改用户代理(agent isn)并不能保证达到预期效果。Web 服务器有多种方法可以绕过此字符串来确定您的浏览方式。但他们很少有这种情况。
更改浏览器用户代理(browser user agent)是无害的,这些是最简单的方法!
What Does a Browser User-Agent Switcher Do & What Are Its Advantages?
Despite
the sleuthy sound of it, browser user-agents are actually quite simple to
υnderstand. Praсtіcally every time you access a high-traffіc website, its
servеr will be taking into account what your current user agent is, which helps
identify your operаting system and browser, in an attеmpt to better deliver
content to you.
Even popular browsers such as Chrome, Firefox, and Safari can often display web content in inconsistent ways when compared with each other. But there are hundreds of user agents out there, ranging from browsers you’ve probably never heard of to email and RSS readers.
In
this article, we’ll discuss the technical side of user agents and how you can
take advantage of software and browser plugins to manipulate how content is
shown on the web.
What Does a Browser User-Agent Switcher Do?
A
user-agent switcher does exactly what it sounds like – it changes the user agent
of your browser. A user agent is a string of text that your browser sends to
the web server it’s communicating with, which describes the user’s operating
system, browser, rendering engine, and other important details.
For
example, this is the user agent for the latest version of Google Chrome on
Windows 10:
Mozilla/5.0
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/77.0.3865.90 Safari/537.36
This
information is passed to web servers via HTTP headers, and it can be used to
change the way that content is displayed. Browsers often render text, images,
and other content differently, so it’s important that the web server
understands exactly what you’re browsing from to display content properly.
A
browser user-agent switcher allows you to modify this string sent through HTTP
headers so that the web server believes you’re browsing from a different
browser than you actually are.
Why Would You Want To Use a Browser User-Agent
Switcher?
There
are several reasons that one might wish to trick a website into thinking
they’re browsing from a different browser.
One
of the most common reasons is in the case of web development. While I strongly
believe that the best practice here is to simply install additional browsers to
get the most genuine experience, switching your browser’s user agent will allow
you a quick and easy peek at what your work looks like in other browsers.
Another
case where browser user-agent switching may be useful is when you’re trying to
view how a website appears on mobile. Maybe you have a slow or limited
connection, or the website has other functionality or features available to
mobile browsers. Switching your user agent allows this without the
inconvenience of having to use your phone.
Changing
your user agent can also assist you in getting around browser-based
restrictions. Though it’s not nearly as common as it was a decade ago, you’ll
sometimes see websites that claim incompatibility with a certain browser build
and will completely deny access to anyone using it. You can work around this by
simply changing the user agent.
Last
but not least, consider your browsing privacy. While a user agent won’t
identify you anywhere near as narrowly as an IP address, you’re still giving up
the way you browse. However, you should be advised that there are ways for
websites to see beyond the user-agent string and identify your browser. In the
case of security, this isn’t foolproof.
How Can You Get a Browser User-Agent Switcher?
Nowadays,
most popular browsers include a developer console that will allow you to change
all sorts of things, such as your viewing resolution and user agent. The
problem is that if you intend to change your user agent frequently, going
through the steps to do it through a developer console can be tedious.
For
that reason, we recommend installing a browser extension or add-on that
simplifies the process of changing your browser user agent. Chrome and Firefox
both offer several options for this purpose, but we’ve selected the two best.
This
Chrome extension has nearly two million total users and was developed by
Google, so its compatibility with the browser should be as good as you’ll ever
find.
Once
installed, this extension adds a button to the right of the address bar that
allows you to select through a total of eight browsers and mobile operating
systems. Upon selecting one, you’re offered a few browser versions supported by
it. Clicking on any will change your user agent.
The
one downside of this extension is that it currently supports very few user
agents. For example, your iOS options are limited to the iPhone 6 and iPad
(which they don’t provide a specific generation for).
This
add-on has been recommended by the Firefox team and has nearly 200,000 users
behind it.
User-Agent
Switcher and Manager is much more robust than the Chrome alternative above, and
it supports dozens of additional browsers and operating systems, all of which
offer many more user agents. Currently, there are 738 supported user agents.
Rather
than just show device names or browser versions, this add-on will actually
display the full user-agent string. Additionally, you can set a custom user
agent.
As
previously mentioned, changing your user agent isn’t a guaranteed way to
achieve the effects you might expect. There are ways for web servers to
determine how you’re browsing that can circumvent this string. But it’s
uncommon for them to go to this length.
Changing
your browser user agent is harmless and these are the easiest ways to do it!