This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

From the user agent, how do I know it is a Android device?

  • 2 பதிலளிப்புகள்
  • 13 இந்த பிரச்னைகள் உள்ளது
  • 6 views
  • Last reply by jameslee

we have a Android game site where we detect the device type and show what games are available.

But on Firefox for mobile, there is no indication in the useragent of what the handset is. In fact it is the same as the firefox 4 desktop browser.

The firefox 4 mobile useragent is Mozilla/5.0 (Android; Linux armv7l; rv:2.1) Gecko/20110318 Firefox/4.0b13pre Fennec/4.0

While the useragent of default browser is Mozilla/5.0 (Linux; U; Android 2.2.1; en-gb; GT-I9000 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

we have a Android game site where we detect the device type and show what games are available. But on Firefox for mobile, there is no indication in the useragent of what the handset is. In fact it is the same as the firefox 4 desktop browser. The firefox 4 mobile useragent is Mozilla/5.0 (Android; Linux armv7l; rv:2.1) Gecko/20110318 Firefox/4.0b13pre Fennec/4.0 While the useragent of default browser is Mozilla/5.0 (Linux; U; Android 2.2.1; en-gb; GT-I9000 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

All Replies (2)

If the User-Agent contains "Fennec/" then it is Firefox for mobile. If it contains "Android" then it is running on an Android device.

We have an open request to add more device info to the User-Agent header. For details, see: https://bugzilla.mozilla.org/show_bug.cgi?id=625238

We'll consider this request, but we must balance it against user privacy, and attacks like browser fingerprinting. For now, in cases where you don't detect a known device from the User-Agent header, you can ask the user instead (for example, have them choose from a list of devices). This will also benefit Android users who have changed their browsers' User-Agent headers for various reasons.

This is very much a solution and many people do use it. However, we are always working to provide the most seamless experience for the user.

Also, I understand that Mozilla may have higher standards but even the default Android browsers, and other 3rd party browsers like opera include the device string into the user-agent.

When developing apps that are very specific to devices, having this device info string works wonders for us.