summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-07-30 13:01:56 +0300
committerArtur Signell <artur@vaadin.com>2015-07-30 17:29:30 +0000
commitbebb7efeaee4f02ac7d844cb0b11524d242eccba (patch)
treedf8134c593e71f3a6feca0ee70bdad1f8b05bab7 /shared
parentedbe0cef91f1776a0ceebd6d47cfd73589cddce3 (diff)
downloadvaadin-framework-bebb7efeaee4f02ac7d844cb0b11524d242eccba.tar.gz
vaadin-framework-bebb7efeaee4f02ac7d844cb0b11524d242eccba.zip
Detect Edge correctly (#18537)
Change-Id: I6aa7e7b7498ff85489843e52bd351e54c4ba70f9
Diffstat (limited to 'shared')
-rw-r--r--shared/src/com/vaadin/shared/VBrowserDetails.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/VBrowserDetails.java b/shared/src/com/vaadin/shared/VBrowserDetails.java
index 561b6c76d0..d0de8ffb9f 100644
--- a/shared/src/com/vaadin/shared/VBrowserDetails.java
+++ b/shared/src/com/vaadin/shared/VBrowserDetails.java
@@ -41,6 +41,7 @@ public class VBrowserDetails implements Serializable {
private boolean isFirefox = false;
private boolean isOpera = false;
private boolean isIE = false;
+ private boolean isEdge = false;
private boolean isPhantomJS = false;
private boolean isWindowsPhone;
@@ -88,6 +89,16 @@ public class VBrowserDetails implements Serializable {
isSafari = !isChrome && !isIE && userAgent.indexOf("safari") != -1;
isFirefox = userAgent.indexOf(" firefox/") != -1;
isPhantomJS = userAgent.indexOf("phantomjs/") != -1;
+ if (userAgent.indexOf(" edge/") != -1) {
+ isEdge = true;
+ isChrome = false;
+ isOpera = false;
+ isIE = false;
+ isSafari = false;
+ isFirefox = false;
+ isWebKit = false;
+ isGecko = false;
+ }
// chromeframe
isChromeFrameCapable = userAgent.indexOf("chromeframe") != -1;
@@ -115,6 +126,8 @@ public class VBrowserDetails implements Serializable {
tmp = tmp.replaceFirst("([0-9]+\\.[0-9]+).*", "$1");
browserEngineVersion = Float.parseFloat(tmp);
}
+ } else if (isEdge) {
+ browserEngineVersion = 0;
}
} catch (Exception e) {
// Browser engine version parsing failed
@@ -158,6 +171,9 @@ public class VBrowserDetails implements Serializable {
i = userAgent.indexOf("opera/") + 6;
}
parseVersionString(safeSubstring(userAgent, i, i + 5));
+ } else if (isEdge) {
+ int i = userAgent.indexOf(" edge/") + 6;
+ parseVersionString(safeSubstring(userAgent, i, i + 8));
}
} catch (Exception e) {
// Browser version parsing failed
@@ -373,6 +389,15 @@ public class VBrowserDetails implements Serializable {
}
/**
+ * Tests if the browser is Edge.
+ *
+ * @return true if it is Edge, false otherwise
+ */
+ public boolean isEdge() {
+ return isEdge;
+ }
+
+ /**
* Tests if the browser is PhantomJS.
*
* @return true if it is PhantomJS, false otherwise