diff options
author | Artur <artur@vaadin.com> | 2017-04-25 15:21:30 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-04-25 15:21:30 +0300 |
commit | 7bf4f7ade8a022119b4c00c8d92e3474a3b2652b (patch) | |
tree | c29d5f57fd0936790fb464e5a8669ccd8a4d16f5 /shared | |
parent | 54e36557c3062d1d5b5fabef561e34847ecde9be (diff) | |
download | vaadin-framework-7bf4f7ade8a022119b4c00c8d92e3474a3b2652b.tar.gz vaadin-framework-7bf4f7ade8a022119b4c00c8d92e3474a3b2652b.zip |
Detect Chrome on iOS as Chrome + Webkit (#9138)
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/VBrowserDetails.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java index c3c1baa582..4fac5db636 100644 --- a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java +++ b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java @@ -79,7 +79,8 @@ public class VBrowserDetails implements Serializable { isWebKit = !isTrident && userAgent.indexOf("applewebkit") != -1; // browser name - isChrome = userAgent.indexOf(" chrome/") != -1; + isChrome = userAgent.indexOf(" chrome/") != -1 + || userAgent.indexOf(" crios/") != -1; isOpera = userAgent.indexOf("opera") != -1; isIE = userAgent.indexOf("msie") != -1 && !isOpera && (userAgent.indexOf("webtv") == -1); @@ -163,7 +164,12 @@ public class VBrowserDetails implements Serializable { int i = userAgent.indexOf(" firefox/") + 9; parseVersionString(safeSubstring(userAgent, i, i + 5)); } else if (isChrome) { - int i = userAgent.indexOf(" chrome/") + 8; + int i = userAgent.indexOf(" chrome/"); + if (i != -1) { + i += " chrome/".length(); + } else { + i = userAgent.indexOf(" crios/") + " crios/".length(); + } parseVersionString(safeSubstring(userAgent, i, i + 5)); } else if (isSafari) { int i = userAgent.indexOf(" version/") + 9; @@ -355,6 +361,16 @@ public class VBrowserDetails implements Serializable { } /** + * Tests if the browser is Safari or runs on IOS (covering also Chrome on + * iOS). + * + * @return true if it is Safari or running on IOS, false otherwise + */ + public boolean isSafariOrIOS() { + return isSafari() || isIOS(); + } + + /** * Tests if the browser is Chrome. * * @return true if it is Chrome, false otherwise |