Starting from Firefox version 13, in the platform-specific part of the
User-Agent HTTP request header, there is an indication of whether Firefox is running on a phone or tablet-sized device.
When Firefox acts on a device
with a mobile phone
form factor , the substring
“ Mobile; "; when Firefox is operating on a tablet device, the substring
“ Tablet; ".
Here are some examples:
')
Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0 Mozilla/5.0 (Android; Tablet; rv:13.0) Gecko/13.0 Firefox/13.0
The CSS Media Queries mechanism is more convenient for finding out the device
form factor . However, if you use the “sniffing” of the
“User-Agent ” header instead
, then please look for Mobile for mobiles
and Tablet for tablets without implying any relationship between the Android line
and the device
form factor . In this case, your code will work even when (if) Firefox will work on other mobile
and (or) tablet operating systems or when Android will be used on laptops, and not just on cell phones and tablets.
Historical note: before the substrings “Mobile”
and “Tablet” were introduced
, instead of them, the mobile and tablet versions of Firefox used the same substring
“Fennec /”, after which the Firefox version was indicated, at the end of the
“User-Agent” header
.