Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Vanwege onderhoudswerkzaamheden die uw ervaring zouden moeten verbeteren, heeft deze website beperkte functionaliteit. Als een artikel uw probleem niet verhelpt en u een vraag wilt stellen, kan onze ondersteuningsgemeenschap u helpen in @FirefoxSupport op Twitter en /r/firefox op Reddit.

Zoeken in Support

Vermijd ondersteuningsscams. We zullen u nooit vragen een telefoonnummer te bellen, er een sms naar te sturen of persoonlijke gegevens te delen. Meld verdachte activiteit met de optie ‘Misbruik melden’.

Meer info

Deze conversatie is gearchiveerd. Stel een nieuwe vraag als u hulp nodig hebt.

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

  • 2 antwoorden
  • 13 hebben dit probleem
  • 6 weergaven
  • Laatste antwoord van jameslee

more options

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

Alle antwoorden (2)

more options

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.

more options

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.