Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

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.