diff options
Diffstat (limited to 'webapp/src/app/common/utils.service.ts')
-rw-r--r-- | webapp/src/app/common/utils.service.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/webapp/src/app/common/utils.service.ts b/webapp/src/app/common/utils.service.ts new file mode 100644 index 0000000..291ffd3 --- /dev/null +++ b/webapp/src/app/common/utils.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; + +@Injectable() +export class UtilsService { + constructor() { } + + getOSName(lowerCase?: boolean): string { + let OSName = "Unknown OS"; + if (navigator.appVersion.indexOf("Linux") !== -1) { + OSName = "Linux"; + } else if (navigator.appVersion.indexOf("Win") !== -1) { + OSName = "Windows"; + } else if (navigator.appVersion.indexOf("Mac") !== -1) { + OSName = "MacOS"; + } else if (navigator.appVersion.indexOf("X11") !== -1) { + OSName = "UNIX"; + } + if (lowerCase) { + return OSName.toLowerCase(); + } + return OSName; + } +}
\ No newline at end of file |