当サイトはユーザー体験を改善するためのメンテナンスを実施中に機能が制限される予定です。記事を読んでもあなたの問題が解決せず質問をしたい場合は、Twitter の @FirefoxSupport、Reddit の /r/firefox で、サポートコミュニティが皆さんを助けようと待機しています。

Mozilla サポートの検索

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.

詳しく学ぶ

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

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

  • 2 件の返信
  • 13 人がこの問題に困っています
  • 6 回表示
  • 最後の返信者: 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

すべての返信 (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.