Add OS checks for Android and ChromeOS

This commit is contained in:
Pierre Ossman
2022-12-23 16:36:49 +01:00
parent 8fb30fb9dc
commit a187821e4f
2 changed files with 52 additions and 1 deletions

View File

@@ -93,6 +93,15 @@ export function isIOS() {
!!(/ipod/i).exec(navigator.platform));
}
export function isAndroid() {
return !!(/android/i).exec(navigator.platform);
}
export function isChromeOS() {
/* ChromeOS sets navigator.platform to Linux :/ */
return !!navigator.userAgent.match(' CrOS ');
}
/* Browser */
export function isSafari() {