mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fix bug where "navigator" may be null in SSR mode
This commit is contained in:
@@ -144,7 +144,7 @@ export class RootComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBrowserName(): string {
|
getBrowserName(): string {
|
||||||
const userAgent = this._window.nativeWindow.navigator.userAgent;
|
const userAgent = this._window.nativeWindow.navigator?.userAgent;
|
||||||
if (/Firefox/.test(userAgent)) {
|
if (/Firefox/.test(userAgent)) {
|
||||||
return 'firefox';
|
return 'firefox';
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ export class RootComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getOSName(): string {
|
getOSName(): string {
|
||||||
const userAgent = this._window.nativeWindow.navigator.userAgent;
|
const userAgent = this._window.nativeWindow.navigator?.userAgent;
|
||||||
if (/Windows/.test(userAgent)) {
|
if (/Windows/.test(userAgent)) {
|
||||||
return 'windows';
|
return 'windows';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user