Какой user agent у mozilla
Klar for Android
Since version 4.1, Klar for Android uses the same UA string as Focus for Android. Before version 4.1, it sent a Klar/ product/version token.
Klar Version (Rendering Engine) | User Agent string |
---|---|
1.0 (WebView) | Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Klar/1.0 Chrome/58.0.3029.83 Mobile Safari/537.36 |
4.1+ (WebView) | Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/4.1 Chrome/62.0.3029.83 Mobile Safari/537.36 |
6.0+ (GeckoView) | Mozilla/5.0 (Android 7.0; Mobile; rv:62.0) Gecko/62.0 Firefox/62.0 |
Примеры
В старых версиях Opera, на базе движка Presto, строки выглядят так:
Opera UA string
The Opera browser is also based on the Blink engine, which is why it almost looks the same as the Chrome UA string, but adds "OPR/" .
Syntax
Common format for web browsers:
Примеры
Firefox UA string
For more on Firefox- and Gecko-based user agent strings, see the Firefox user agent string reference. The UA string of Firefox is broken down into 4 components:
- Mozilla/5.0 is the general token that says that the browser is Mozilla-compatible. For historical reasons, almost every browser today sends it.
- platform describes the native platform that the browser is running on (Windows, Mac, Linux, Android, etc.) and if it is a mobile phone. Firefox OS phones say Mobile — the web is the platform. Note that platform can consist of multiple " ; "-separated tokens. See below for further details and examples.
- rv:geckoversion indicates the release version of Gecko (such as "17.0"). In recent browsers, geckoversion is the same as firefoxversion.
- Gecko/geckotrail indicates that the browser is based on Gecko. (On the desktop, geckotrail is always the fixed string 20100101 .)
- Firefox/firefoxversion indicates that the browser is Firefox and provides the version (such as "17.0").
Safari UA string
In this example, the user agent string is mobile Safari's version. It contains the word "Mobile" .
В этой статье мы расскажем о том, что такое User-Agent, для чего он нужен и как с его помощью делать всякие нужные штуки. Эта информация пригодится тем, кто планирует всерьез самостоятельно заняться оптимизацией своего сайта, уделяя особое внимание вопросам безопасности. Вслед за этой статьей появится еще несколько материалов, посвященных оптимизации сайтов, не пропустите.
Итак, User-Agent. В обычной жизни нас с вами можно идентифицировать по разным параметрам: голос и внешность выдают в нас мужчину или женщину, форма — военного или доктора. Помимо таких очевидных, есть ряд прочих критериев, которые позволяют нам определить, с кем имеешь дело, и как именно стоит себя вести в данной ситуации. Похожим образом происходит взаимодействие с сайтами — веб-приложение сообщает данные о себе, а сайт в свою очередь может обрабатывать их различными способами. Эта информация передается в User-Agent, о котором пойдет речь далее.
Windows
Windows user agents have the following variations, where x.y is the Windows NT version (for instance, Windows NT 6.1).
Windows version | Gecko user agent string |
---|---|
Windows NT on x86 or aarch64 CPU | Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0 |
Windows NT on x64 CPU | Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0 |
Как узнать, от каких User-Agent поступают запросы к вашему сайту?
Информация о каждом запросе хранится в журнале отдельной строкой, например:
Разберем подробнее те части записи, которые нас интересуют в контексте статьи.
Focus for Android
From version 1, Focus is powered by Android WebView and uses the following user agent string format:
Tablet versions on WebView mirror mobile, but do not contain a Mobile token.
Starting in Version 6, users can opt into using a GeckoView-based Focus for Android with a hidden preference: it uses a GeckoView UA string to advertise Gecko compatibility.
Focus Version (Rendering Engine) | User Agent string |
---|---|
1.0 (WebView Mobile) | Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/1.0 Chrome/59.0.3029.83 Mobile Safari/537.36 |
1.0 (WebView Tablet) | Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/1.0 Chrome/59.0.3029.83 Safari/537.36 |
6.0 (GeckoView) | Mozilla/5.0 (Android 7.0; Mobile; rv:62.0) Gecko/62.0 Firefox/62.0 |
Как заменить User-Agent браузера?
Обычно замена User-Agent применяется, чтобы проверить правила для роботов и утилит.
Не секрет, что каждый из браузеров при формировании страницы сайта обрабатывает полученные с сервера данные особым образом. Соответственно, если в браузере Firefox указать User-Agent браузера Chrome, результат отображения сайта может быть совершенно неожиданным. Об этом обязательно следует помнить. Всегда возвращайте исходное значение User-Agent после завершения тестирования.
Инструкция по замене User-Agent в Mozilla Firefox (для версий 34.0 и выше)
Наберите в адресной строке вашего браузера следующую фразу:
Новое значение должно появится в списке параметров. Перезапускать Mozilla Firefox не требуется.
Инструкция по замене User-Agent в Google Chrome (для версий 26.0.1410.64 и выше)
Чтобы указать для Google Chrome нестандартный User-Agent, его необходимо запустить с ключом
и в кавычках указать новую строку User-Agent.
Например, в ОС Windows это можно сделать, нажав сочетание клавиш Win+R и вписав в поле «Открыть» команду:
где вместо MyBrowser должен быть указан нужный вам User-Agent.
Например, чтобы присвоить Google Chrome значение User-Agent консольного браузера Links, следует ввести в поле «Открыть» строку
и нажать на кнопку «ОК».
После этого открывшееся окно браузера будет иметь не стандартный, а заданный User-Agent. Чтобы проверить текущее значение User-Agent, можно ввести в адресной строке:
Информацию о том, как изменить User-Agent других браузеров, можно найти в их документации.
Microsoft Edge UA string
The Edge browser is also based on the Blink engine. It adds "Edg/" .
Examples
Mobile and Tablet indicators
Note: Only from Firefox 11 to 68.
The platform part of the UA string indicates if Firefox is running on a phone-sized or tablet device. When Firefox runs on a device that has the phone form factor, there is a Mobile; token in the platform part of the UA string. When Firefox runs on a tablet device, there is a Tablet; token in the platform part of the UA string instead. For example:
Note: The version numbers are not relevant. Avoid inferring materials based on these.
The preferred way to target content to a device form factor is to use CSS Media Queries. However, if you use UA sniffing to target content to a device form factor, please look for Mobi (to include Opera Mobile, which uses "Mobi") for the phone form factor and do not assume any correlation between "Android" and the device form factor. This way, your code will work if/when Firefox ships on other phone/tablet operating systems or Android is used for laptops. Also, please use touch detection to find touch devices rather than looking for "Mobi" or "Tablet", since there may be touch devices which are not tablets.
Note: Firefox OS devices identify themselves without any operating system indication; for example: "Mozilla/5.0 (Mobile; rv:15.0) Gecko/15.0 Firefox/15.0". The web is the platform.
Что такое User-Agent, какую информацию он передает?
Ниже рассмотрены различные варианты User-Agent с расшифровкой тех данных, на которые следует обратить внимание.
Браузеры ПК на примере Mozilla Firefox 36 (Win 8.1 x64):
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0
Windows NT 6.3 — вид и версия операционной системы компьютера, на котором установлен браузер.
Firefox/36.0 — имя браузера и его версия.
Мобильные браузеры на примере Android 2.3.5 (Philips W632):
Mozilla/5.0 (Linux; U; Android 2.3.5; ru-ru; Philips W632 Build/GRJ90) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Linux — тип операционной системы (семейство Linux).
Android 2.3.5 — название операционной системы и ее версия.
ru-ru — язык на мобильном устройстве по умолчанию.
Philips W632 Build/GRJ90 — название и версия мобильного устройства, на котором установлен браузер.
Поисковые системы на примере роботов Яндекс:
Утилиты на примере wget (Linux):
Wget/1.15 — название и версия программного обеспечения.
Примеры
Firefox for Fire TV
Version 3 (and probably earlier) of Firefox for Fire TV use a user agent string with the following format:
Firefox TV version | User Agent string |
---|---|
v3.0 | Mozilla/5.0 (Linux; Android 7.1.2) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/3.0 Chrome/59.0.3017.125 Safari/537.36 |
Firefox for Echo Show
From version 1.1, Firefox for Echo Show uses a user agent string with the following format:
Firefox for Echo Show version | User agent string |
---|---|
v1.1 | Mozilla/5.0 (Linux; Android 5.1.1) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/1.1 Chrome/59.0.3017.125 Safari/537.36 |
Android (version 40 and below)
Form factor | Gecko user agent string |
---|---|
Phone | Mozilla/5.0 (Android; Mobile; rv:40.0) Gecko/40.0 Firefox/40.0 |
Tablet | Mozilla/5.0 (Android; Tablet; rv:40.0) Gecko/40.0 Firefox/40.0 |
Оглавление
Вы можете изменить user agent в Firefox, чтобы обмануть сайты, заставив их думать, что вы используете другую версию браузера или операционной системы. Веб-разработчики могут делать это, чтобы проверить, как их веб-сайты будут отображаться в различных системах и браузерах. Иногда, дополнения и другие программы могут изменить user agent без вашего ведома.
Чтобы просмотреть ваш user agent, щёлкните по кнопке меню Firefox , щёлкните Справка Справка и выберите Информация для решения проблем Информация для решения проблем . Откроется страница с адресом about:support. Раздел Сведения о приложении покажет вашу текущую версию Firefox и будет содержать запись User Agent. Например, запись user agent для Firefox версии 83 в Windows 10 (64-разрядная версия) по умолчанию будет выглядеть следующим образом:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0
Примечание: Если ваш user agent показывает предыдущую версию Windows, например, Windows NT 6.1 (Windows 7) вместо Windows NT 10.0 (Windows 10), убедитесь, что вы не используете Firefox в режиме совместимости. Вы можете открыть Свойства ярлыка Firefox на рабочем столе из контекстного меню, вызываемого правой кнопкой мыши. Проверьте вкладку "Совместимость" и убедитесь, что не выбран вариант режима совместимости.
Такие дополнения, как расширение User-Agent Switcher, могут изменять user agent, который определяют веб-сайты. Посмотрите, сможете ли вы восстановить user agent по умолчанию в настройках вашего расширения. Вы также можете временно перезапустить Firefox со всеми отключенными дополнениями (прочитайте статью Решение проблем в Firefox с использованием Безопасного режима для получения дополнительной информации) и, если проблема уйдёт, отключить или удалить все дополнения, которые, по вашему мнению, могут быть причиной. Если вы не можете решить проблему таким способом, выполните следующие действия, чтобы сбросить user agent по умолчанию.
Вы можете сбросить user agent следующим образом:
Прочитайте статью Редактор настроек Firefox для получения дополнительной информации об использовании страницы about:config для сброса или удаления параметров.
Примечание: Если вышеуказанное решение не решает проблему, проверьте, установлен ли у вас параметр privacy.resistFingerprinting в true , и, если это так, дважды щёлкните по нему, чтобы сбросить его на false . Этот параметр может изменить user agent и вызвать этот тип проблемы. Для получения дополнительной информации прочитайте статью Защита Firefox от сборщиков цифровых отпечатков.
После сброса вашего user agent вам, возможно, потребуется перезапустить Firefox и очистить ваши куки и кэш:
This document describes the user agent string used in Firefox 4 and later and applications based on Gecko 2.0 and later. For a breakdown of changes to the string in Gecko 2.0, see Final User Agent string for Firefox 4 (blog post). See also this document on user agent sniffing and this Hacks blog post.
Строка UA в Chrome
Строка user agent в Chrome и браузерах, основанных на движке Chromium/Blink, аналогична строке Firefox. Для совместимости добавлены строки KHTML, like Gecko и Safari .
Linux
Linux is a more diverse platform. Your distribution of Linux might include an extension that changes your user-agent. A few common examples are given below.
Linux version | Gecko user agent string |
---|---|
Linux desktop on i686 CPU | Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0 |
Linux desktop on x86_64 CPU | Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0 |
Nokia N900 Linux mobile, on the Fennec browser | Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0) Gecko/20100101 Firefox/10.0 Fennec/10.0 |
Строка UA в Opera
Браузер Opera также основан на движке Blink, поэтому его строка user agent совпадает со строкой Chrome, только в конце добавляется "OPR/" .
Examples
Focus for iOS
Version 7 of Focus for iOS uses a user agent string with the following format:
Note: this user agent was retrieved from an iPhone XR simulator and may be different on device.
Device-specific user agent strings
Although it is strongly discouraged by Mozilla, some handset manufacturers unfortunately include a token in their device's UA string that represents their device id. If this is the case, the Firefox OS UA string will look like the device-specific string in the table above, where nnnn; is the manufacturer's code for the device (see Guidelines). Some of them we have noticed are of the form "NexusOne;", "ZTEOpen;", or "Open C;" (note that putting space is also discouraged). We provide this information to assist with your UA detection logic, but Mozilla discourages the detection of a device id in UA strings.
Here is a JavaScript regular expression that will detect all mobile devices, including devices with a device id in their UA string:
The i makes it case-insensitive, and mobi matches all mobile browsers.
Chrome UA string
The Chrome (or Chromium/Blink-based engines) user agent string is similar to Firefox's. For compatibility, it adds strings like KHTML, like Gecko and Safari .
Строка UA в Safari
В этом примере строка user agent представлена в мобильной версии Safari и содержит слово "Mobile" .
The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent.
Warning: Please read Browser detection using the user agent for why serving different Web pages or services to different browsers is usually a bad idea.
Firefox OS
Form factor | Gecko user agent string |
---|---|
Phone | Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0 |
Tablet | Mozilla/5.0 (Tablet; rv:26.0) Gecko/26.0 Firefox/26.0 |
TV | Mozilla/5.0 (TV; rv:44.0) Gecko/44.0 Firefox/44.0 |
Device-specific | Mozilla/5.0 (Mobile; nnnn; rv:26.0) Gecko/26.0 Firefox/26.0 |
General form
The UA string of Firefox itself is broken down into four components:
Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion
- Mozilla/5.0 is the general token that says the browser is Mozilla compatible, and is common to almost every browser today.
- platform describes the native platform the browser is running on (e.g. Windows, Mac, Linux or Android), and whether or not it's a mobile phone. Firefox OS phones say " Mobile "; the web is the platform. Note that platform can consist of multiple "; "-separated tokens. See below for further details and examples.
Note: Though fixed in Firefox 69, previous 32-bit versions of Firefox running on 64-bit processors would report that the system is using a 32-bit CPU.
Note: The recommended way of sniffing for Gecko-based browsers (if you have to sniff for the browser engine instead of using feature detection) is by the presence of the " Gecko " and " rv: " strings, since some other browsers include a " like Gecko " token.
For other products based on Gecko, the string can take one of two forms, where the tokens have the same meaning except those noted below:
Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail appname/appversion Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion appname/appversion
- appname/appversion indicates the application name and version. For instance, this could be " Camino/2.1.1 ", or " SeaMonkey/2.7.1 ".
- Firefox/firefoxversion is an optional compatibility token that some Gecko-based browsers may choose to incorporate, to achieve maximum compatibility with websites that expect Firefox. firefoxversion will generally represent the equivalent Firefox release corresponding to the given Gecko version. Some Gecko-based browsers may not opt into using this token; for this reason, sniffers should be looking for Gecko — not Firefox!
Prior to Firefox 4 and Gecko 2.0, it was possible for extensions and plug-ins to add user agent parts, but that has not been possible since bug 581008.
Examples
Android (version 41 and above)
Beginning in version 41, Firefox for Android will contain the Android version as part of the platform token. For increased interoperability, if the browser is running on a version below 4 it will report 4.4. Android versions 4 and above will report the version accurately. Note that the same Gecko—with the same capabilities—is shipped to all versions of Android.
Form factor | Gecko user agent string |
---|---|
Phone | Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0 |
Tablet | Mozilla/5.0 (Android 4.4; Tablet; rv:41.0) Gecko/41.0 Firefox/41.0 |
Примеры
Синтаксис
Общий формат для веб-браузеров:
Directives
A product identifier — its name or development codename.
Version number of the product.
Zero or more comments containing more details. For example, sub-product information.
Как запретить доступ к сайту по User-Agent?
Ответ достаточно прост — всего при помощи нескольких правил в файле .htaccess, сформировать и добавить которые не составит труда даже новичку. Освежить знания по работе с файлом .htaccess вам поможет статья в нашем блоге.
Рассмотрим пример, в котором используются правила, запрещающие доступ к сайту с использованием утилиты wget:
В первой строке после параметра User-Agent в кавычках указан User-Agent утилиты Wget, которому присваивается имя bad_bot. Во второй строке указывается необходимость блокировки доступа (Deny) для запроса, пришедшего от bad_bot.
Вместо «^Wget» может быть указан User-Agent любого браузера или робота, имя bad_bot может быть присвоено любому количеству User-Agent, то есть правила
запретят доступ для всех перечисленных User-Agent.
Чтобы убедиться в том, что изменения внесены успешно, вовсе не обязательно искать большое количество различных устройств для проверки работы сайта — гораздо удобнее воспользоваться встроенными почти во все современные браузеры функциями подмены User-Agent.
Firefox OS version number
While the version number for Firefox OS is not included in the UA string, it is possible to infer version information from the Gecko version number present in the UA string.
Firefox OS version number | Gecko version number |
---|---|
1.0.1 | 18.0 |
1.1 | 18.1 |
1.2 | 26.0 |
1.3 | 28.0 |
1.4 | 30.0 |
2.0 | 32.0 |
2.1 | 34.0 |
2.2 | 37 |
2.5 | 44 |
Note: It's easy to find the correspondences by looking at the Mercurial repository names: repositories starting by mozilla-b2g are the release repositories for Firefox OS, and have both Firefox OS and Gecko versions in their names.
Firefox OS has a four-digit version number: X.X.X.Y . The first two digits are owned by the Mozilla product team and denote versions with new features (eg: v1.1, 1.2, etc). The third digit is incremented with regular version tags (about every 6 weeks) for security updates, and the fourth is owned by the OEM.
Other Gecko-based browsers
These are some sample UA strings from other Gecko-based browsers on various platforms. Note that many of these have not yet been released on Gecko 2.0!
Заголовок запроса User-Agent - это строка с характеристиками, по которым сервера и сетевые узлы могут определить тип приложения, операционную систему, производителя и/или версию пользовательского агента.
Обратите внимание: Показывать ту или иную страницу в зависимости от характеристик пользовательского агента — дурная практика. Почему не стоит так делать, читайте в статье «Определение браузера по пользовательскому агенту».
Macintosh
Here, x.y is the version of Mac OS X (for instance, Mac OS X 10.15). Starting in Firefox 87, Firefox caps the reported Mac OS X version number to 10.15, so macOS 11.0 Big Sur and later will be reported as "10.15" in the User-Agent string.
Mac OS X version | Gecko user agent string |
---|---|
Mac OS X on x86, x86_64, or aarch64 | Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0 |
Mac OS X on PowerPC | Mozilla/5.0 (Macintosh; PPC Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0 |
Зачем сайту знать, с каким User-Agent к нему пришли?
Как видно из приведенных выше примеров, по User-Agent очень просто определить, откуда пришел запрос — это может быть компьютер, планшет, мобильное устройство, поисковый робот или некое программное обеспечение.
Информация об источнике запроса может быть необходима для решения следующих задач:
- перенаправление запросов на мобильную версию;
- использование специфических стилей для определенных браузеров;
- сбор статистики о количестве запросов с разных устройств;
- создание специальных правил для обработки запросов от роботов;
- запрет доступа к сайту для каких-либо веб-утилит;
- всякие другие штуки.
Значительная часть перечисленных задач требует опыта разработки скриптов на PHP, но не стоит пугаться — для большинства популярных CMS уже существуют расширения, обладающие необходимыми функциями, и вам достаточно найти подходящий плагин или модуль, чтобы получить желаемый результат.
Мы же подробнее разберем ситуацию, когда требуется запретить доступ к сайту по User-Agent. Чаще всего это необходимо для исключения из индексации поисковыми роботами файлов из определенной директории, блокировки нежелательных роботов, создающих нагрузку на сайте, или же обеспечения безопасности, если к сайту поступает множество подозрительных запросов с различных IP-адресов, но с одинаковым User-Agent.
Строка UA в Firefox
Подробные сведения о user agent строках в Firefox и других браузерах, основанных на движке Gecko, вы найдёте в справочнике.
Строка UA в Firefox разбита на 4 части и одну общую метку для всех:
- Mozilla/5.0 — общая метка, которая сообщает, что браузер совместим с Mozilla. По историческим причинам сегодня такую метку отправляет почти каждый браузер.
- platform указывает платформу, на которой работает браузер (Windows, Mac, Linux, Android и т.д.), а так же, мобильный ли это телефон. В телефонах на Firefox OS (en-US) указывается только Mobile , поскольку Firefox OS построена на веб-технологиях. Обратите внимание, platform может содержать несколько значений, разделённых ; . Подробная информация и примеры ниже.
- rv:geckoversion указывает релизную версию Gecko (например, "17.0"). В последних браузерах geckoversion совпадает с firefoxversion.
- Gecko/geckotrail указывает, что браузер основан на Gecko (на компьютерах geckotrail — всегда строка 20100101 ).
- Firefox/firefoxversion обозначает, что браузером является Firefox, и указывает его версию (например, "17.0").
Директивы
Идентификатор продукта — его название или кодовое имя.
Может быть пустым или содержать дополнительную информацию. Например, информацию о продукте.
Firefox for iOS
Firefox for iOS uses the default Mobile Safari UA string, with an additional FxiOS/ token on iPod and iPhone, similar to how Chrome for iOS identifies itself.
Form factor | Firefox for iOS user agent string |
---|---|
iPod | Mozilla/5.0 (iPod touch; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4 |
iPhone | Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4 |
iPad | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15 |
Regarding the deviation on iPad form factor, see this issue.
Строка UA в Microsoft Edge
Браузер Microsoft Edge также основан на движке Blink, поэтому его строка user agent совпадает со строкой Chrome, только в конце добавляется "Edg/" .
Examples
Older, Presto-based Opera releases used:
Читайте также: