如何检查网站查看器的操作系统?

发布于 2024-08-15 21:59:45 字数 284 浏览 3 评论 0原文

我运行的是 Ubuntu 8.04,最近在访问网站时收到以下错误:

请使用运行 Windows 98、2000、Me、NT 或 XP 的计算机返回 www.site.com。

  1. 网站如何知道我正在运行哪个操作系统?是仅通过 JavaScript 还是请求标头中也有操作系统信息?

  2. 有没有办法让我绕过此检查或“假装”使用 Windows,以便即使我运行的是不受支持的操作系统也可以访问该网站?

I'm running Ubuntu 8.04 and I recently received the following error when visiting a website:

Please return to www.site.com with a computer running Windows 98, 2000, Me, NT, or XP.

  1. How does the website know which OS I'm running? Is it only via javascript or is there OS information in the request headers as well?

  2. Is there a way for me to bypass this check or "pretend" to be using Windows so that I can access the website even though I'm running an unsupported OS?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(7

凡间太子 2024-08-22 21:59:45

我可以模仿其他浏览器/平台吗?

有很多方法可以欺骗用户代理字符串。在firefox中,恰好有一个名为“User Agent Switcher”的扩展,它允许您模仿其他浏览器。

https://addons.mozilla.org/en-US/firefox/addon/59

用户代理

经常检查用户代理可以告诉您这一点。例如,我的用户代理是:

Mozilla/5.0(Windows;U;Windows NT 6.0;en-US)AppleWebKit/532.0(KHTML,如 Gecko)Chrome/3.0.195.38 Safari/532.0

我使用的是哪个平台?

Javascript 选项

您还可以使用 Javascript 中的 navigator 对象来获取一些信息。例如:

alert(navigator.platform);  // alerts Win32
alert(navigator.userAgent); // Mozilla/5.0 (Windows; U; Windows NT 6.0...

PHP 选项

您可以从 $_SERVER 数组获取 PHP 中的用户代理:

print $_SERVER["HTTP_USER_AGENT"]; // Mozilla/5.0 (Windows; U; Windows NT...

PHP 还有更多好处,例如 get_browser()* PHP 中的函数,返回一组信息,包括平台:

Array
(
    ...
    [parent] => Firefox 0.9
    [platform] => WinXP
    [browser] => Firefox
    [version] => 0.9
    ...
)

* get_browser() 依赖于 browscap.ini - 请参阅
http://www.php.net...php#ini.browscap 了解更多信息。

Can I Imitate Another Browser/Platform?

There are many ways to spoof user agent strings. In firefox, there happens to be an extension called "User Agent Switcher," which allows you to imitate other browsers.

https://addons.mozilla.org/en-US/firefox/addon/59

User Agents

Checking the user-agent often times can tell you this. For instance, my user-agent is:

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.38 Safari/532.0

Which platform am I on?

Javascript Option

You can also use the navigator object in Javascript to get some information too. For instance:

alert(navigator.platform);  // alerts Win32
alert(navigator.userAgent); // Mozilla/5.0 (Windows; U; Windows NT 6.0...

PHP Options

You can get the user-agent in PHP from the $_SERVER array:

print $_SERVER["HTTP_USER_AGENT"]; // Mozilla/5.0 (Windows; U; Windows NT...

PHP also has further goodies, such as the get_browser()* function in PHP which returns an array of information, including the platform:

Array
(
    ...
    [parent] => Firefox 0.9
    [platform] => WinXP
    [browser] => Firefox
    [version] => 0.9
    ...
)

* get_browser() relies upon browscap.ini - See
http://www.php.net...php#ini.browscap for more information.

梦冥 2024-08-22 21:59:45

网站如何知道我正在运行哪个操作系统?是仅通过 JavaScript 还是请求标头中也有操作系统信息?

每次您访问时,该信息都会出现在 User-Agent HTTP header 中向任何服务器发出请求。

有没有办法让我绕过此检查或“假装”使用 Windows,以便即使我运行的是不受支持的操作系统也可以访问该网站?

检查此链接以获取User-Agent<中的更多信息/code> 使用 Firefox 进行欺骗。

How does the website know which OS I'm running? Is it only via javascript or is there OS information in the request headers as well?

That info goes in the User-Agent HTTP header each time you make a request to any server.

Is there a way for me to bypass this check or "pretend" to be using Windows so that I can access the website even though I'm running an unsupported OS?

Check this link for more info in User-Agent spoofing using firefox.

金兰素衣 2024-08-22 21:59:45

您可以在 JavaScript 中使用 navigator.platform

var OS = navigator.platform;
alert(OS);

这样您就不需要担心解析用户代理。

You can use navigator.platform in JavaScript:

var OS = navigator.platform;
alert(OS);

That way you don't have to worry about parsing the user agent.

醉酒的小男人 2024-08-22 21:59:45

它可能是从 User-Agent 字符串中猜测的。

It may be guessing from the User-Agent string.

如梦初醒的夏天 2024-08-22 21:59:45

这是完整的代码。可能对某人有帮助,它检测哪个操作系统用户正在使用和版本,但它并没有深入到 Window 7 home/professional/ultimate 等版本,那个版本要复杂得多。

//OS DETECTION... 
function find_os(){ 
var OSVer=""; 
if (navigator.userAgent.indexOf("Mac OS X 10.4")!=-1) OSVer="MacOS Tiger"; 
if (navigator.userAgent.indexOf("Mac OS X 10.5")!=-1) OSVer="MacOS Leopard"; 
if (navigator.userAgent.indexOf("Mac OS X 10.6")!=-1) OSVer="MacOS Snow Leopard"; 
if (navigator.userAgent.indexOf("NT 5.1")!=-1) OSVer="Windows XP"; 
if (navigator.userAgent.indexOf("NT 6.0")!=-1) OSVer="Windows Vista"; 
if (navigator.userAgent.indexOf("NT 6.1")!=-1) OSVer="Windows 7"; 
if (navigator.userAgent.indexOf("Linux")!=-1) OSVer="Linux"; 
if (navigator.userAgent.indexOf("X11")!=-1) OSVer="UNIX"; 

returh OSVer; 
}

Here is the full code. Might help someone, it detects which OS user is using and version, but it doesnt go that deep in versions such as Window 7 home/professional/ultimate etc, that one is way more complex.

//OS DETECTION... 
function find_os(){ 
var OSVer=""; 
if (navigator.userAgent.indexOf("Mac OS X 10.4")!=-1) OSVer="MacOS Tiger"; 
if (navigator.userAgent.indexOf("Mac OS X 10.5")!=-1) OSVer="MacOS Leopard"; 
if (navigator.userAgent.indexOf("Mac OS X 10.6")!=-1) OSVer="MacOS Snow Leopard"; 
if (navigator.userAgent.indexOf("NT 5.1")!=-1) OSVer="Windows XP"; 
if (navigator.userAgent.indexOf("NT 6.0")!=-1) OSVer="Windows Vista"; 
if (navigator.userAgent.indexOf("NT 6.1")!=-1) OSVer="Windows 7"; 
if (navigator.userAgent.indexOf("Linux")!=-1) OSVer="Linux"; 
if (navigator.userAgent.indexOf("X11")!=-1) OSVer="UNIX"; 

returh OSVer; 
}
回忆追雨的时光 2024-08-22 21:59:45

用户代理切换器 firefox 插件可以“欺骗”不同的网络浏览器。

The User Agent Switcher firefox add-on enables "spoofing" of a different web browser.

杯别 2024-08-22 21:59:45

服务器端脚本将向网络浏览器提供信息,指示用户的浏览器类型和版本以及操作系统。例如,在 PHP 中,您有 get_browser()

Opera 浏览器有一个功能到欺骗,并且可以将自己呈现为另一种浏览器类型以避免浏览器阻塞。

The server-side script will present information to the web browser which indicates the user's browser type and version as well as operating system. For example, in PHP you have get_browser()

Opera browser has a facility to Spoof and can present itself as another browser type to avoid browser blocking.

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