diff options
author | Dos Moonen <darsstar@gmail.com> | 2017-03-22 07:46:00 +0100 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2017-03-22 08:46:00 +0200 |
commit | baa0baf8d6f06dc234c610a0ed558cd66c6c67b4 (patch) | |
tree | 4109300dccb76c8d6023fef53ad1b1ddfb2ea528 /shared | |
parent | ec0b52a1b6c506a184121c303adb5e4e4711b8f3 (diff) | |
download | vaadin-framework-baa0baf8d6f06dc234c610a0ed558cd66c6c67b4.tar.gz vaadin-framework-baa0baf8d6f06dc234c610a0ed558cd66c6c67b4.zip |
Check Trident version to detect compatibility mode (#8884)
IE11 in compatibility mode is actually not too old. It's just not recognized as IE11 if you leave the Trident version out of the equation. Checking the Trident version and using it to determine the actual IE version instead of trusting the possibly emulated MSIE version string.
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/VBrowserDetails.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java index 2b6018f314..99dac478bc 100644 --- a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java +++ b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java @@ -120,13 +120,13 @@ public class VBrowserDetails implements Serializable { .substring(userAgent.indexOf("webkit/") + 7); tmp = tmp.replaceFirst("([0-9]+)[^0-9].+", "$1"); browserEngineVersion = Float.parseFloat(tmp); - } else if (isIE) { - int tridentPos = userAgent.indexOf("trident/"); - if (tridentPos >= 0) { - String tmp = userAgent - .substring(tridentPos + "Trident/".length()); - tmp = tmp.replaceFirst("([0-9]+\\.[0-9]+).*", "$1"); - browserEngineVersion = Float.parseFloat(tmp); + } else if (isTrident) { + String tmp = userAgent + .substring(userAgent.indexOf("trident/") + 8); + tmp = tmp.replaceFirst("([0-9]+\\.[0-9]+).*", "$1"); + browserEngineVersion = Float.parseFloat(tmp); + if (browserEngineVersion > 7) { + browserEngineVersion = 7; } } else if (isEdge) { browserEngineVersion = 0; @@ -148,6 +148,9 @@ public class VBrowserDetails implements Serializable { tmp = tmp.replaceFirst("(\\.[0-9]+).+", "$1"); parseVersionString(tmp); } + } else if (isTrident) { + // See https://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx#TriToken + setIEMode((int) browserEngineVersion + 4); } else { String ieVersionString = userAgent .substring(userAgent.indexOf("msie ") + 5); @@ -565,7 +568,6 @@ public class VBrowserDetails implements Serializable { * supported or might work */ public boolean isTooOldToFunctionProperly() { - // Check Trident version to detect compatibility mode if (isIE() && getBrowserMajorVersion() < 11) { return true; } |