有没有办法在 Windows Phone 8.1 Update 2 上检测新的 IE 版本?
Is there a way to detect the new IE version on Windows Phone 8.1 Update 2?
对 Windows Phone 的每次更新都会为内部 Internet Explorer 带来新的 features/bugs。
我们希望知道一种检测 8.1 Update 2 (GDR2) 的方法。
大概有一个功能或错误可以嗅探到以下之一:
添加到 GDR2 的功能,或
GDR1 中的一个错误现已在 GDR2 中修复,或者
检测到添加到 GDR2 中的错误(不稳定的嗅探,因为可能会修补错误,所以不太理想)。
注意微软给出的changelist。另请注意,尽可能使用特征检测,但仍然需要嗅探,因为:(1)您不能总是找到检测 feature/bug 的方法(一些 CSS 错误,一些需要用户交互的错误), (2) 我们想用异常日志和其他记录信息记录浏览器版本(这样我们就可以找到问题的模式),以及 (3) 我们想在一个地方显示任何设备的版本,以便我们的用户可以轻松地向我们报告(无需我们要求他们进入特定于设备的设置等)。
编辑:Here is example code that detects the different Windows Phone updates (for update 1, 2, and 10. You can edit javascript。)
在 Update 2 中,他们似乎删除了对 2011 风格 flexbox(带有 ms 前缀)的支持,可以通过以下代码对其进行测试:
'msFlexAlign' in document.documentElement.style
对于 Internet Explorer 11 移动更新 1,此 returns 为真,对于 IE11 更新 2 returns 为假。Here 是一个 jsbin 测试。
请注意,这是我使用 Modernizr 3 cow tests, and comparing the Results for update 1 and the Results for update 2 发现的。只有一处不同,flexboxtweener 值从 true 变为 false。
编辑:如果您需要检测 Update 1,那么检测 WP8.1 上的 IE11 和 WP8.1 Update 1 之间差异的一种方法是 8.1 Update 1(以及 Update 2)支持 document.ontouchstart,您可以使用 window 中的 'ontouchstart' 进行测试。但是请注意 Windows Phone 10 (10.0.10586) 上的应用程序如果使用 WebView(WebView 在 window 中使用 IE11 和 'ontouchstart' === false,它会再次恢复!!! 呜呜呜)。
编辑:如果在 Windows Phone 10 (Windows 10 Mobile 10.0.10586) 上为目标 WP8.1 编译的应用程序中使用 WebView,则它使用 IE11 和应用程序不使用 Microsoft Edge! WTF:那个版本的 IE11 returns 对 'msFlexAlign' in document.documentElement.style
是正确的,所以似乎更新 1 和更新 2 的更改在 WP10 中丢失或恢复了 - 哎哟。您可以在 WP10/W10M(更新 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 文档是 "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."(注意:我们的经验是为目标 Windows 8 编译的应用程序在文档模式 10 下使用 IE,并且必须为目标 8.1 创建一个新的空项目并且所有内容在文档模式 11 中使用 IE11 之前从旧项目复制过来。
对 Windows Phone 的每次更新都会为内部 Internet Explorer 带来新的 features/bugs。
我们希望知道一种检测 8.1 Update 2 (GDR2) 的方法。
大概有一个功能或错误可以嗅探到以下之一:
添加到 GDR2 的功能,或
GDR1 中的一个错误现已在 GDR2 中修复,或者
检测到添加到 GDR2 中的错误(不稳定的嗅探,因为可能会修补错误,所以不太理想)。
注意微软给出的changelist。另请注意,尽可能使用特征检测,但仍然需要嗅探,因为:(1)您不能总是找到检测 feature/bug 的方法(一些 CSS 错误,一些需要用户交互的错误), (2) 我们想用异常日志和其他记录信息记录浏览器版本(这样我们就可以找到问题的模式),以及 (3) 我们想在一个地方显示任何设备的版本,以便我们的用户可以轻松地向我们报告(无需我们要求他们进入特定于设备的设置等)。
编辑:Here is example code that detects the different Windows Phone updates (for update 1, 2, and 10. You can edit javascript。)
在 Update 2 中,他们似乎删除了对 2011 风格 flexbox(带有 ms 前缀)的支持,可以通过以下代码对其进行测试:
'msFlexAlign' in document.documentElement.style
对于 Internet Explorer 11 移动更新 1,此 returns 为真,对于 IE11 更新 2 returns 为假。Here 是一个 jsbin 测试。
请注意,这是我使用 Modernizr 3 cow tests, and comparing the Results for update 1 and the Results for update 2 发现的。只有一处不同,flexboxtweener 值从 true 变为 false。
编辑:如果您需要检测 Update 1,那么检测 WP8.1 上的 IE11 和 WP8.1 Update 1 之间差异的一种方法是 8.1 Update 1(以及 Update 2)支持 document.ontouchstart,您可以使用 window 中的 'ontouchstart' 进行测试。但是请注意 Windows Phone 10 (10.0.10586) 上的应用程序如果使用 WebView(WebView 在 window 中使用 IE11 和 'ontouchstart' === false,它会再次恢复!!! 呜呜呜)。
编辑:如果在 Windows Phone 10 (Windows 10 Mobile 10.0.10586) 上为目标 WP8.1 编译的应用程序中使用 WebView,则它使用 IE11 和应用程序不使用 Microsoft Edge! WTF:那个版本的 IE11 returns 对 'msFlexAlign' in document.documentElement.style
是正确的,所以似乎更新 1 和更新 2 的更改在 WP10 中丢失或恢复了 - 哎哟。您可以在 WP10/W10M(更新 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 文档是 "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."(注意:我们的经验是为目标 Windows 8 编译的应用程序在文档模式 10 下使用 IE,并且必须为目标 8.1 创建一个新的空项目并且所有内容在文档模式 11 中使用 IE11 之前从旧项目复制过来。