Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

javascript - Is there a way to detect the new IE version on Windows Phone 8.1 Update 2?

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

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. a feature added into GDR2, or

  2. a bug in GDR1 now fixed in GDR2, or

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

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).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

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

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.

Edit: 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).

Edit: 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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...