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 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算