safari 代理_如何在OS X上更改Safari的用户代理

safari 代理

safari 代理_如何在OS X上更改Safari的用户代理

You’ve probably been annoyed at one time or another when visiting a website that requires a specific browser. Luckily, you can fool a website into thinking you’re using a different browser and you can do this with most, including Safari.

当您访问需要特定浏览器的网站时,可能一次或一次让您感到烦恼。 幸运的是,您可以使一个网站误以为您正在使用其他浏览器,并且可以使用大多数浏览器(包括Safari)来做到这一点。

User agent “spoofing” is not a new thing. It was sometimes necessary when there was a so-called browser war. Website designers would often design pages to render and deliver different content depending on the user’s browser. The solution to this was often to send a false “user agent string,” which would fool the web server into delivering you the preferred content.

用户代理“欺骗”并不是什么新鲜事物。 有时在发生所谓的浏览器大战时很有必要。 网站设计人员通常会设计页面来呈现和传递不同的内容,具体取决于用户的浏览器。 解决此问题的方法通常是发送错误的“用户代理字符串”,这会使Web服务器欺骗您以提供首选内容。

Today, users are less likely to have a problem since websites and browsers are better at adhering to web standards. That’s not to say you won’t still encounter one every now and then.

如今,用户很少会遇到问题,因为网站和浏览器更擅长遵守Web标准。 并不是说您不会时不时遇到一个。

If you use Apple OS X’s Safari, here’s how you change the user agent, and even create custom ones as well.

如果您使用Apple OS X的Safari,则可以通过以下方法更改用户代理,甚至还可以创建自定义代理。

无论如何,用户代理是什么? (What is a User Agent Anyway?)

When Safari visits a website, it will send a string of text such as this:

Safari访问网站时,将发送如下文本字符串:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3.18

Mozilla / 5.0(Macintosh; Intel Mac OS X 10_10_2)AppleWebKit / 600.3.18(KHTML,like Gecko)Version / 8.0.3 Safari / 600.3.18

This tells the web server that this particular user is running Safari 8 on a Mac running OS X 10.10.2.

这告诉Web服务器该特定用户正在运行OS X 10.10.2的Mac上运行Safari 8。

It will obviously be different per the operating system and web browser. A computer running Windows 7 and Internet Explorer 10 would appear as such:

每个操作系统和Web浏览器显然有所不同。 运行Windows 7和Internet Explorer 10的计算机将显示如下:

Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)

Mozilla / 5.0(兼容; MSIE 10.0; Windows NT 6.1; Trident / 6.0)

The list of user agent strings is quite extensive because there are so many browsers on different operating systems. By the way, it’s possible to see what information your browser reveals about you, which includes your screen resolution, IP address, and more.

用户代理字符串列表非常广泛,因为不同操作系统上的浏览器太多了。 顺便说一句,可以查看浏览器显示的有关您的信息 ,包括屏幕分辨率,IP地址等。

在Safari上更改用户代理 (Changing Your User Agent on Safari )

We’ve discussed the ways you can change the user agent on Google Chrome, Internet Explorer, and Firefox. Let’s discuss now how to change it on Apple OS X’s Safari.

我们已经讨论了在Google Chrome,Internet Explorer和Firefox上更改用户代理的方法 。 现在让我们讨论如何在Apple OS X的Safari上进行更改。

First, open Safari’s preferences from the “Safari” menu or with “Command + ,”.

首先,从“ Safari”菜单或使用“ Command +”打开Safari的首选项。

safari 代理_如何在OS X上更改Safari的用户代理

With the preferences open, click on the “Advanced” tab. At the very bottom, you want to check the box next to “Show Develop menu in the menu bar” and then exit out of the preferences.

打开首选项后,单击“高级”选项卡。 在最底部,您要选中“在菜单栏中显示开发菜单”旁边的框,然后退出首选项。

safari 代理_如何在OS X上更改Safari的用户代理

Now Safari will have a new menu devoted solely to development tools.

现在,Safari将有一个专门用于开发工具的新菜单。

The “User Agent” menu is at the top. There’s already quite a few options available including preceding versions of Safari on OS X and iOS, Chrome on Mac and Windows, as well as an “Other…” option.

“用户代理”菜单在顶部。 已经有很多选项可用,包括OS X和iOS上的Safari的早期版本,Mac和Windows上的Chrome,以及“其他…”选项。

safari 代理_如何在OS X上更改Safari的用户代理

The “Other…” option allows you to specify a user agent other than those listed, such as if you’re curious to see how Google Chrome on an iPad running iOS 8.2 renders, you’d use the appropriate string.

“其他…”选项允许您指定除列出的用户代理之外的其他用户代理,例如,如果您想查看运行iOS 8.2的iPad上的Google Chrome浏览器是如何渲染的,则可以使用适当的字符串。

safari 代理_如何在OS X上更改Safari的用户代理

When you open the “Other…” option from the User Agent menu then, you’d simply type of copy the user agent string for the browser you want to test.

然后,从用户代理菜单中打开“其他…”选项时,只需键入要测试的浏览器的用户代理字符串的复制类型即可。

safari 代理_如何在OS X上更改Safari的用户代理

Afterwards, the new user agent will appear in the User Agent menu. Note, however, you can only have one “other” user agent at a time.

之后,新的用户代理将出现在“用户代理”菜单中。 但是请注意,一次只能有一个“其他”用户代理。

safari 代理_如何在OS X上更改Safari的用户代理

As we suggested in the introduction, it’s unusual to have to change your user agent because most browsers are fairly good now at adhering to standards, and most websites are browser agnostic (though some browsers work better on some sites than others).

正如我们在引言中所建议的那样,通常无需更改用户代理,因为大多数浏览器现在都非常擅长遵守标准,并且大多数网站都与浏览器无关(尽管某些浏览器在某些站点上的工作情况比其他站点更好)。

On a related note, if you’re curious to see how your browser does with regard to web standards, you can always try the Acid Tests developed by the Web Standards Project.

与此相关的是,如果您想了解浏览器在Web标准方面的表现,可以随时尝试由Web Standards Project开发的Acid Tests

That said, we hope you’ve found this article useful. If you have anything you’d like to add, such as a question or a comment, please provide feedback in our discussion forum.

就是说,我们希望您对本文有所帮助。 如果您有任何要添加的内容,例如问题或评论,请在我们的论坛中提供反馈。

翻译自: https://www.howtogeek.com/211961/how-to-change-safaris-user-agent-in-os-x/

safari 代理

相关文章: