有没有办法在Windows Phone 8.1 Update 2上检测新的IE版本? [英] Is there a way to detect the new IE version on Windows Phone 8.1 Update 2?

查看:104
本文介绍了有没有办法在Windows Phone 8.1 Update 2上检测新的IE版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows Phone的每次更新都会给内部Internet Explorer带来新的功能/错误。

Every update to Windows Phone brings new features/bugs to the internal Internet Explorer.

我们想知道一种检测8.1 Update 2(GDR2)的方法。

We wish to know a way to detect 8.1 Update 2 (GDR2).

据推测,有一个功能或错误可以被嗅探:

Presumably there is a feature or bug that can be sniffed for one of:


  1. 添加到GDR2中的功能,或

  1. a feature added into GDR2, or

GDR1中的错误现已在GDR2中修复,或

a bug in GDR1 now fixed in GDR2, or

检测到添加到GDR2的错误(不稳定的嗅探,因此很可能因为可能被修补的错误而被淘汰)。

detect a bug added to GDR2 (unstable sniff, so much less desirable because bug likely to be patched).

注意更改列表由微软提供。另请注意,尽可能使用特征检测,但仍需要嗅探,因为:(1)您无法总是找到检测功能/错误的方法(一些CSS错误,一些需要用户交互的错误),以及(2)我们想要使用异常日志记录浏览器版本,以及其他记录的信息(以便我们可以找到问题的模式),以及(3)我们希望在一个地方显示任何设备的版本,以便我们的用户可以轻松地向我们报告(没有我们要求他们进入设备特定的设置等)。

Note The changelist given by microsoft. Also note feature detection is used when possible, but sniffing is still needed because: (1) you cannot always find a way to detect the feature/bug (some CSS bugs, some bugs that require user interaction), and (2) we want to log the browser version with exception logs, and other logged information (so we can find patterns to problems), and (3) we want to show a version for any device in a single place so that our users can easily report it to us (without us asking them to go into device specific Settings etc).

推荐答案

编辑:这里是检测不同Windows Phone更新的示例代码(对于更新1,2和10.您可以编辑 javascript。)

Here is example code that detects the different Windows Phone updates (for update 1, 2, and 10. You can edit the javascript.)

在Update 2中,它们似乎取消了对2011的支持样式flexbox(带有ms前缀),可以通过以下代码进行测试:

In Update 2 it looks like they removed support for the 2011 style flexbox (with ms prefixes) which can be tested for by the following code:

'msFlexAlign' in document.documentElement.style

对于Internet Explorer 11 Mobile Update 1,返回true ,并在IE11 Update 2中返回false。此处是jsbin测试。

This returns true for Internet Explorer 11 Mobile Update 1, and returns false for IE11 Update 2. Here is a jsbin test.

注意我发现这是通过使用Modernizr 3 牛测试,并比较更新结果1 更新2的结果。只有一个区别,flexboxtweener值从true变为false。

Note I found this by using the Modernizr 3 cow tests, and comparing the Results for update 1 and the Results for update 2. There was only one difference, the flexboxtweener value changed from true to false.

编辑:如果需要检测Update 1,那么有办法检测IE11之间的区别WP8.1和WP8.1 Update 1是8.1 Update 1(也是Update 2)支持document.ontouchstart,您可以在窗口中使用'ontouchstart'进行测试。但要注意Windows Phone 10(10.0.10586)上的应用程序如果使用WebView(WebView在窗口中使用IE11和'ontouchstart'= = false !!! Arrrgggh),它将再次恢复。

If you need to detect Update 1, then a way to detect the difference between IE11 on WP8.1 and WP8.1 Update 1 is that 8.1 Update 1 (And Update 2 as well) supports document.ontouchstart which you can test using 'ontouchstart' in window. However beware that an App on Windows Phone 10 (10.0.10586) it reverts again if using a WebView (A WebView uses IE11 and 'ontouchstart' in window === false!!! Arrrgggh).

编辑:如果在Windows Phone 10(Windows 10 Mobile 10.0.10586)上为目标WP8.1编译的应用程序中使用WebView,则它使用IE11,而应用程序不使用Microsoft Edge! WTF:IE11的那个版本对于document.documentElement.style 中的'msFlexAlign'返回true,所以似乎更新1和更新2的更改在WP10中丢失或恢复 - 哎哟。您可以在WP10 / W10M(Update 3; - |)上检测IE11,因为它在用户代理中具有Trident / 8.0,而WP8.1上的IE11具有Trident / 7.0。如果用户代理包含WebView / 2.0,您可能只会查找差异(尽管 https://msdn.microsoft.com/en-us/library/hh869301(v = vs.85).aspx 也提到MSAppHost)。如果使用设置|可能会发生其他事情桌面模式(除其他更改之外,删除Windows Phone 8.1并将WPDesktop添加到用户代理),或者如果使用X-UA-Compatible将文档模式更改为< IE11)。 Windows文档是在为Windows 10编译的应用程序中,WebView使用Microsoft Edge呈现引擎显示HTML内容。在为Windows 8或Windows 8.1编译的应用程序中,WebView在文档模式下使用Internet Explorer 11。 (CAVEAT:我们的经验是,针对目标Windows 8编译的应用程序在文档模式10中使用IE,并且必须创建目标8.1的新空项目,并且在文档模式11中使用IE11之前从旧项目复制所有内容) 。

If using a WebView in an App compiled for target WP8.1 on Windows Phone 10 (Windows 10 Mobile 10.0.10586) then it uses IE11 and an App does not use Microsoft Edge! WTF: That version of IE11 returns true for 'msFlexAlign' in document.documentElement.style so it seems that changes for Update 1 and Update 2 were lost or reverted in WP10 - ouch. You can detect IE11 on WP10/W10M (Update 3 ;-|) because it has "Trident/8.0" in the user agent whereas IE11 on WP8.1 has "Trident/7.0". You might only look for the difference if the user agent contains "WebView/2.0" (although https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx also mentions "MSAppHost"). Other things may happen if using Settings | Desktop Mode (which amongst other changes removes "Windows Phone 8.1" and adds "WPDesktop" to the user agent), or if using X-UA-Compatible to change document mode to < IE11). Windows docs are "In apps compiled for Windows 10, WebView uses the Microsoft Edge rendering engine to display HTML content. In apps compiled for Windows 8 or Windows 8.1, WebView uses Internet Explorer 11 in document mode." (CAVEAT: Our experience was that apps compiled for target Windows 8 use IE in document mode 10, and a new empty project for target 8.1 had to be created and everything copied over from the old project before it would use IE11 in document mode 11).

这篇关于有没有办法在Windows Phone 8.1 Update 2上检测新的IE版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆