The general templates for the Silk User Agent on the Kindle Fire and Kindle Fire HD are:
Desktop
Mozilla/5.0 (Linux; U; locale; product-model Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version Safari/webkit-version Silk-Accelerated=cloud-browsing-state
Mobile
Mozilla/5.0 (Linux; U; Android android-version; locale; product-model Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version Mobile Safari/webkit-version Silk-Accelerated=cloud-browsing-state
Italicized fields are variable as described in the following section.
Template fields
locale – lower-case, in the format language-country, for example “en-us” (US English).
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 – the version of WebKit used, for example “535.19″
browser-version – a two-part version number in the form major version.minor version, for example “2.0″. We guarantee that this version number will increase (according to a lexicographic order) with every new release of the browser.
cloud-browsing-state – “true” if cloud browsing is enabled, “false” otherwise.
Related product models
Kindle Fire – KFOT
Kindle Fire HD – KFTT
Kindle Fire HD 8.9″ WiFi – KFJWI
Kindle Fire HD 8.9″ 4G – KFJWA
Some examples
Desktop
Mozilla/5.0 (Linux; U; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.1 Safari/535.19 Silk-Accelerated=true
Mobile
Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.1 Mobile Safari/535.19 Silk-Accelerated=true
Silk UA for Kindle Fire 1st Generation
Desktop
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
Bolded fields are variable. Specifically, the numeric value will increment with software updates, while the Silk-Accelerated value can be either “true” or “false” depending upon customer selection.
User Agent Detection
Below is sample JavaScript code for detecting the Silk User Agent across all device families.
Basic Silk identification
if (/\bSilk\b/.test(navigator.userAgent)) {
alert("Silk detected!");
}
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)"));
}
Example of detecting multiple variables
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)"));
}
