I'm trying to detect with javascript if my website is running on a kindle fire mobile device. I've tried with navigator.userAgent and navigator.appVersion but I get this results on kindle :
5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
and
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
What can I use form those strings to know that I'm on a kindle and not on other device?
The User Agent String for Kindle Fire is:
In Silk mode:
there are two things you should check for 1/ Silk (or Silk-Accelerated) 2/ "Kindle", "KFOT", "KFTT" or others from the table at https://developer.amazon.com/sdk/fire/specifications.html
In Silk or pass-through #1 should give you confirmation, if the web page is being accessed from a WebView then #2 will catch it
One problem is that Amazon changes the strings for every new model. You could check only for Kindle, Silk and KF* but that could potentially lead to false positives. I have altered the code a bit from one of the examples above to make a bit more readable and easy to maintain.
As of November 18, 2015, the below code should work.
Check https://developer.amazon.com/sdk/fire/specifications.html for new models.
This is the code I wrote to redirect people to my game Luna Puma from my website for both Kindle Fire and Android phones:
in Javascript ,
The Silk User-Agent and example JavaScript code to detect Silk can be found on the blog: http://amazonsilk.wordpress.com/useful-bits/silk-user-agent/