Меню Рубрики

Linux firefox user agent

Как изменить User-Agent в Firefox?

User-Agent — часть HTTP запросов, который содержит такую информацию, как название и версию приложения, операционную систему компьютера и язык.

Ранее мы писали о том, как изменить User-Agent в Chrome и для чего это нужно. В браузере Mozilla Firefox также есть возможность изменения User-Agent(a):

1. Введите в адресную строку «about:config» и нажмите «Enter».

2. Введите в поиске «useragent».

3. Найдите «general.useragent.override».

4. Если ее нет, то создайте вручную.

5. Кликните правой кнопкой мыши на пустом месте.

6. Выберите «New», затем «String».

7. Вставьте «general.useragent.override» в поле названия параметра.

8. Введите желаемый User-Agent. Например:

Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

Этот параметр применяется к каждой открытой вкладке и сохраняется до тех пор, пока вы его не измените, даже если вы перезапустите Firefox.

Источник

Firefox user agent string reference

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.

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 simply say » Mobile «; the web is the platform. Note that platform can consist of multiple «; «-separated tokens. See below for further details and examples.

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.

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! Whether this token appears is controlled by the «general.useragent.compatMode.firefox» boolean pref.

Mobile and Tablet indicators

Only from Firefox 11 onwards.

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:

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.

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 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

Macintosh

Here, x.y is the version of Mac OS X (for instance, Mac OS X 10.6).

Mac OS X version Gecko user agent string
Mac OS X on Intel x86 or x86_64 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

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

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

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

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

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

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.

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

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

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.

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

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.

Firefox for iOS

Firefox for iOS uses the default Mobile Safari UA string, with an additional FxiOS/ token, 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 (iPad; 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

Firefox Web Runtime

The Web Runtime uses the same user agent string as desktop Firefox.

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!

Browser Gecko user agent string
Firefox for Maemo (Nokia N900) Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
Camino on Mac Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Camino/2.2.1
SeaMonkey on Windows Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1
SeaMonkey on Mac Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1
SeaMonkey on Linux Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1

Implementation notes for applications, vendors, and extensions

Prior to Firefox 4 and Gecko 2.0, it was possible for extensions to add user agent parts through the general.useragent.extra.identifier preferences, (see the obsolete User Agent Strings Reference). But that has not been possible since bug 581008.

In the past, specific plug-ins, add-ons or extensions added user agent parts to notify sites they were installed. The recommended way to do this, if it’s absolutely necessary (remember that it slows down every request) is to set a custom HTTP header.

See Also

Metadata

  1. HTTP
  2. Guides:
  3. Resources and URIs
    1. Identifying resources on the Web
    2. Data URIs
    3. Introduction to MIME Types
    4. Complete list of MIME Types
    5. Choosing between www and non-www URLs
  4. HTTP guide
    1. Basics of HTTP
    2. Overview of HTTP
    3. Evolution of HTTP
    4. HTTP Messages
    5. A typical HTTP session
    6. Connection management in HTTP/1.x
    7. Protocol upgrade mechanism
  5. HTTP security
    1. Content Security Policy (CSP)
    2. HTTP Public Key Pinning (HPKP)
    3. HTTP Strict Transport Security (HSTS)
    4. Cookie security
    5. X-Content-Type-Options
    6. X-Frame-Options
    7. X-XSS-Protection
    8. Mozilla web security guidelines
    9. Mozilla Observatory
  6. HTTP access control (CORS)
  7. HTTP authentication
  8. HTTP caching
  9. HTTP compression
  10. HTTP conditional requests
  11. HTTP content negotiation
  12. HTTP cookies
  13. HTTP range requests
  14. HTTP redirects
  15. HTTP specifications
  16. Feature policy
  17. References:
  18. HTTP headers
    1. Accept
    2. Accept-Charset
    3. Accept-Encoding
    4. Accept-Language
    5. Accept-Patch
    6. Accept-Ranges
    7. Access-Control-Allow-Credentials
    8. Access-Control-Allow-Headers
    9. Access-Control-Allow-Methods
    10. Access-Control-Allow-Origin
    11. Access-Control-Expose-Headers
    12. Access-Control-Max-Age
    13. Access-Control-Request-Headers
    14. Access-Control-Request-Method
    15. Age
    16. Allow
    17. Alt-Svc
    18. Authorization
    19. Cache-Control
    20. Clear-Site-Data
    21. Connection
    22. Content-Disposition
    23. Content-Encoding
    24. Content-Language
    25. Content-Length
    26. Content-Location
    27. Content-Range
    28. Content-Security-Policy
    29. Content-Security-Policy-Report-Only
    30. Content-Type
    31. CookieCookie2
    32. Cross-Origin-Resource-Policy
    33. DNT
    34. Date
    35. Digest
    36. ETag
    37. Early-Data
    38. Expect
    39. Expect-CT
    40. Expireselements in the document.»> Feature-Policy
    41. Forwarded
    42. From
    43. Host
    44. If-Match
    45. If-Modified-Since
    46. If-None-Match
    47. If-Range
    48. If-Unmodified-Since
    49. Index
    50. Keep-AliveLarge-Allocation
    51. Last-Modified
    52. element.»> Link
    53. Location
    54. OriginPragma
    55. Proxy-Authenticate
    56. Proxy-Authorization
    57. Public-Key-Pins
    58. Public-Key-Pins-Report-Only
    59. Range
    60. Referer
    61. Referrer-Policy
    62. Retry-After
    63. Save-Data
    64. Sec-WebSocket-Accept
    65. Server
    66. Server-Timing
    67. Set-CookieSet-Cookie2
    68. SourceMap
    69. Strict-Transport-Security
    70. TE
    71. Timing-Allow-Origin
    72. Tk
    73. Trailer
    74. Transfer-Encoding
    75. Upgrade-Insecure-Requests
    76. User-Agent
    77. Vary
    78. Via
    79. WWW-Authenticate
    80. Want-Digest
    81. Warning
    82. X-Content-Type-Options
    83. X-DNS-Prefetch-ControlX-Forwarded-ForX-Forwarded-HostX-Forwarded-Proto
    84. , , or . Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.»> X-Frame-Options
    85. X-XSS-Protection
  19. HTTP request methods
    1. CONNECT
    2. DELETE
    3. GET
    4. HEAD
    5. OPTIONS
    6. PATCH
    7. POST
    8. PUT
    9. TRACE
  20. HTTP response status codes
    1. 100 Continue
    2. 101 Switching Protocols
    3. 103 Early Hints
    4. 200 OK
    5. 201 Created
    6. 202 Accepted
    7. 203 Non-Authoritative Information
    8. 204 No Content
    9. 205 Reset Content
    10. 206 Partial Content
    11. 300 Multiple Choices
    12. 301 Moved Permanently
    13. 302 Found
    14. 303 See Other
    15. 304 Not Modified
    16. 307 Temporary Redirect
    17. 308 Permanent Redirect
    18. 400 Bad Request
    19. 401 Unauthorized
    20. 402 Payment Required
    21. 403 Forbidden
    22. 404 Not Found
    23. 405 Method Not Allowed
    24. 406 Not Acceptable
    25. 407 Proxy Authentication Required
    26. 408 Request Timeout
    27. 409 Conflict
    28. 410 Gone
    29. 411 Length Required
    30. 412 Precondition Failed
    31. 413 Payload Too Large
    32. 414 URI Too Long
    33. 415 Unsupported Media Type
    34. 416 Range Not Satisfiable
    35. 417 Expectation Failed
    36. 418 I’m a teapot
    37. 422 Unprocessable Entity
    38. 425 Too Early
    39. 426 Upgrade Required
    40. 428 Precondition Required
    41. 429 Too Many Requests
    42. 431 Request Header Fields Too Large
    43. 451 Unavailable For Legal Reasons
    44. 500 Internal Server Error
    45. 501 Not Implemented
    46. 502 Bad Gateway
    47. 503 Service Unavailable
    48. 504 Gateway Timeout
    49. 505 HTTP Version Not Supported
    50. 506 Variant Also Negotiates
    51. 507 Insufficient Storage
    52. 508 Loop Detected
    53. 511 Network Authentication Required
  21. CSP directives
    1. element. If this value is absent, then any URI is allowed. If this directive is absent, the user agent will use the value in the element.»> CSP: base-uri
    2. CSP: block-all-mixed-content
    3. and . For workers, non-compliant requests are treated as fatal network errors by the user agent.»> CSP: child-src
    4. CSP: connect-src
    5. CSP: default-src
    6. CSP: font-src
    7. CSP: form-action
    8. , , , , or .»> CSP: frame-ancestors
    9. and .»> CSP: frame-src
    10. CSP: img-src
    11. CSP: manifest-src
    12. and elements.»> CSP: media-src
    13. (if form-action is not specified), , window.location, window.open, etc. This is an enforcement on what navigations this document initiates not on what this document is allowed to navigate to.»> CSP: navigate-to
    14. , , and elements.»> CSP: object-src
    15. CSP: plugin-types
    16. CSP: prefetch-srcCSP: referrer
    17. CSP: report-to
    18. CSP: report-uri
    19. CSP: require-sri-for
    20. sandbox attribute. It applies restrictions to a page’s actions including preventing popups, preventing the execution of plugins and scripts, and enforcing a same-origin policy.»> CSP: sandbox
    21. Sign In

      Sign in to enjoy the benefits of an MDN account. If you haven’t already created an account, you will be prompted to do so after signing in.

      Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Mac os не удаляется файл
  • Mac os не удалось открыть файл так как у вас нет разрешения на его просмотр
  • Mac os не удается завершить операцию так как у вас нет необходимых прав
  • Mac os не ставится на ssd
  • Mac os не работает левый клик