diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts index 194d40f414..fd0b20df09 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts @@ -366,7 +366,12 @@ export class OpenViduComponentsConfigService { * @returns The base href of the application as a string. */ getBaseHref(): string { - const baseHref = this.document.getElementsByTagName('base')[0].href; + const base = this.document.getElementsByTagName('base'); + if (!base || base.length === 0) { + return '/'; + } + + const baseHref = base[0].href; if (baseHref) { return baseHref; }