Skip to content

Commit

Permalink
Add Firefox OS detection regex & properties (mobile & tablet) (detect…
Browse files Browse the repository at this point in the history
…-firefoxos)
  • Loading branch information
thomastheyoung committed Oct 22, 2014
1 parent 0c364cf commit 6da83f8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
playbook = ua.match(/PlayBook/),
chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/),
firefox = ua.match(/Firefox\/([\d.]+)/),
firefoxos = ua.match(/\((?:Mobile|Tablet); rv:([\d.]+)\).*Firefox\/[\d.]+/),
ie = ua.match(/MSIE\s([\d.]+)/) || ua.match(/Trident\/[\d](?=[^\?]+).*rv:([0-9.].)/),
webview = !chrome && ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/),
safari = webview || ua.match(/Version\/([\d.]+)([^S](Safari)|[^M]*(Mobile)[^S]*(Safari))/)
Expand Down Expand Up @@ -50,6 +51,7 @@
if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true
if (chrome) browser.chrome = true, browser.version = chrome[1]
if (firefox) browser.firefox = true, browser.version = firefox[1]
if (firefoxos) os.firefoxos = true, os.version = firefoxos[1]
if (ie) browser.ie = true, browser.version = ie[1]
if (safari && (osx || os.ios)) {browser.safari = true; if (osx) browser.version = safari[1]}
if (webview) browser.webview = true
Expand Down

0 comments on commit 6da83f8

Please sign in to comment.