Amazon Silk
Developer Guide
« PreviousNext »
View the PDF for this guide.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Amazon Silk User Agent Strings

In the User-Agent request header field, Amazon Silk sends one of three user agent strings, depending on the view requested on the device by the customer. The templates for the Silk user agents are shown below.

Tablet

Mozilla/5.0 (Linux; U; Android android-version; locale; product-model Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) 
    Silk/browser-version like Chrome/chrome-version Safari/webkit-version

Desktop

Mozilla/5.0 (X11; Linux x86_64; U; locale) AppleWebKit/webkit-version (KHTML, like Gecko) 
    Silk/browser-version like Chrome/chrome-version Safari/webkit-version

Mobile

Mozilla/5.0 (Linux; U; Android android-version; locale; product-model Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) 
    Silk/browser-version like Chrome/chrome-version Mobile Safari/webkit-version

Note

Red and italics indicates variable fields, which are described below.

The Silk UA for Kindle Fire 1st Generation follows a slightly different syntax.

Template fields

  • locale – Indicates the chosen language and country or region for the tablet. Locale is in hyphenated lowercase format, as in en-us (US English). For Kindle Fire (1st Generation), locale is always en-us.

  • product-model – The value of Build.MODEL (for example, KFTT).

  • android-version – The Android platform version (for example, 4.0.3).

  • product-build – The value of Build.ID (for example, IML74K).

  • webkit-version – Indicates the version of WebKit used (for example, 535.19). This value can change whenever the Kindle Fire receives a software update.

  • browser-version – Indicates the version of the Silk browser, in the format major.minor (for example, 2.1). The browser version can change whenever the Kindle Fire receives a software update.

  • chrome-version – The version of Google Chrome with which the Silk browser is compatible.

Related product models

  • Kindle FireKFOT

  • Kindle Fire HDKFTT

  • Kindle Fire HD 8.9"KFJWI

  • Kindle Fire HD 8.9" 4GKFJWA

  • Kindle Fire HD 7" (3rd Generation)KFSOWI

  • Kindle Fire HDX 7" (3rd Generation)KFTHWI

  • Kindle Fire HDX 7" (3rd Generation) 4GKFTHWA

  • Kindle Fire HDX 8.9" (3rd Generation)KFAPWI

  • Kindle Fire HDX 8.9" (3rd Generation) 4GKFAPWA

  • Fire PhoneSD4930UR

User Agent String Examples

Examples of the Silk User Agent String

Tablet

Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; KFTHWI Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) 
    Silk/3.22 like Chrome/34.0.1847.137 Safari/537.36

Desktop

Mozilla/5.0 (X11; Linux x86_64; U; en-us) AppleWebKit/537.36 (KHTML, like Gecko) 
    Silk/3.22 like Chrome/34.0.1847.137 Safari/537.36

Mobile

Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; KFTHWI Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) 
    Silk/3.22 like Chrome/34.0.1847.137 Mobile Safari/537.36

Silk UA for Kindle Fire 1st Generation

In the examples below, red and italic text indicates variable fields. The Silk-Accelerated value can be either true or false, depending upon customer selection.

Desktop/Tablet

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true

Mobile

Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Silk-Accelerated=true

User Agent Detection

You can use JavaScript to detect the Silk user agent across various Kindle Fire device families. Unless you want to provide a unique experience for different Kindle Fire devices, we recommend a general match that will work over time as product models and version numbers change. The following examples illustrate best practices for matching the Silk user agent across Kindle Fire device types.

Note

The tests below also match the user agent string for the PlayStation Vita browser. If this is a concern, you can exclude that browser using the following condition:

!/Playstation/.test(navigator.userAgent)

To detect Silk

   
    if (/\bSilk\b/.test(navigator.userAgent)) {
        alert("Silk detected!");
    }

        

To detect the Silk version

   
    var match = /\bSilk\/([0-9._-]+)\b/.exec(navigator.userAgent);
    if (match) { 
        alert("Detected Silk version "+match[1]);
    }

        

To detect mobile/desktop preference


    var match = /\bSilk\/(.*\bMobile Safari\b)?/.exec(navigator.userAgent);
    if (match) {
        alert("Detected Silk in mode "+(match[1] ? "Mobile" : "Default (desktop)"));
    }

        

To detect multiple variables at once


    var match = /(?:; ([^;)]+) Build\/.*)?\bSilk\/([0-9._-]+)\b(.*\bMobile Safari\b)?/.exec(navigator.userAgent);
    if (match) {
        alert("Detected Silk version "+match[2]+" on device "+(match[1] || "Kindle Fire")+" in mode "+(match[3] ? "Mobile" : "Default (desktop)"));
    }