Skip to content

Commit

Permalink
feat(browser): include iOS Chrome UA pattern when detecting Google Ch…
Browse files Browse the repository at this point in the history
…rome (#5262)

Make IS_CHROME return true and IS_ANY_SAFARI return false for iOS Chrome.
  • Loading branch information
bcdarius authored and gkatsev committed Jun 26, 2018
1 parent ceed382 commit b430461
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ Html5.canOverrideAttributes = function() {
* - False otherwise
*/
Html5.supportsNativeTextTracks = function() {
return browser.IS_ANY_SAFARI;
return browser.IS_ANY_SAFARI || (browser.IS_IOS && browser.IS_CHROME);
};

/**
Expand Down
10 changes: 5 additions & 5 deletions src/js/utils/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export const IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebki

export const IS_FIREFOX = (/Firefox/i).test(USER_AGENT);
export const IS_EDGE = (/Edge/i).test(USER_AGENT);
export const IS_CHROME = !IS_EDGE && (/Chrome/i).test(USER_AGENT);
export const IS_CHROME = !IS_EDGE && ((/Chrome/i).test(USER_AGENT) || (/CriOS/i).test(USER_AGENT));
export const CHROME_VERSION = (function() {
const match = USER_AGENT.match(/Chrome\/(\d+)/);
const match = USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);

if (match && match[1]) {
return parseFloat(match[1]);
if (match && match[2]) {
return parseFloat(match[2]);
}
return null;
}());
Expand All @@ -81,7 +81,7 @@ export const IE_VERSION = (function() {
}());

export const IS_SAFARI = (/Safari/i).test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;
export const IS_ANY_SAFARI = IS_SAFARI || IS_IOS;
export const IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;

export const TOUCH_ENABLED = Dom.isReal() && (
'ontouchstart' in window ||
Expand Down

0 comments on commit b430461

Please sign in to comment.