dskpywvki951583595 2015-02-16 15:57
浏览 28
已采纳

WindowsPhone哪个用户代理是正确的?

Anyone know why php and jscript output different user agents?

And also, which one is correct?

PHP

<?php print_r($_SERVER['HTTP_USER_AGENT']); ?>

Output: Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; Microsoft; Lumia535) like iPhone OS7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537)

jScript

alert(navigator.userAgent);

Output: Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; Microsoft; Lumia 535

  • 写回答

1条回答 默认 最新

  • doulian8485 2015-10-19 10:30
    关注

    In our portal, we detect the calling device over the UAS. I have detected some problems with the WP 8.1 user agent string. For WP with IE, set to mobile over the Internet, I receive the "meaningful" UAS:

    Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 930) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537

    Whereby, if IE mobile is set to "Desktop" or the portal is called over the Intranet, I receive:

    Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop; Lumia 930) like Gecko

    So.. the effect was, that our portal has showed the mobile page to iOS, instead of the mobile page to WP. The workaround was to query the UAS for "Windows Phone" before the query for iPhone. It seems as MS tries, to be detected as mobile device on this way (if a page only queries for iOS and Android-devices), what is not nice.
    Therefore, there is not "one" correct UAC, you have to support more than one...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿