@@ -187,6 +187,7 @@ export class AppComponent {
187187
188188 if ( ! expirationToken ) {
189189 this . setUserLoggedIn ( false ) ;
190+ this . setDefaultFavicon ( ) ;
190191 }
191192
192193 this . navigationTabs = {
@@ -323,35 +324,12 @@ export class AppComponent {
323324 this . whiteLabelSettingsLoaded = true ;
324325
325326 if ( whiteLabelSettings . favicon ) {
326- const link : HTMLLinkElement | null = document . querySelector ( "link[rel*='icon']" ) ;
327- if ( link ) {
328- link . href = whiteLabelSettings . favicon ;
329- } else {
330- const newLink = document . createElement ( 'link' ) ;
331- newLink . rel = 'icon' ;
332- newLink . href = whiteLabelSettings . favicon ;
333- document . head . appendChild ( newLink ) ;
334- }
327+ const newLink = document . createElement ( 'link' ) ;
328+ newLink . rel = 'icon' ;
329+ newLink . href = whiteLabelSettings . favicon ;
330+ document . head . appendChild ( newLink ) ;
335331 } else {
336- const faviconIco = document . createElement ( 'link' ) ;
337- faviconIco . rel = 'icon' ;
338- faviconIco . type = 'image/x-icon' ;
339- faviconIco . href = 'assets/favicon.ico' ;
340-
341- const favicon16 = document . createElement ( 'link' ) ;
342- favicon16 . rel = 'icon' ;
343- favicon16 . type = 'image/png' ;
344- favicon16 . setAttribute ( 'sizes' , '16x16' ) ;
345- favicon16 . href = 'assets/favicon-16x16.png' ;
346-
347- const favicon32 = document . createElement ( 'link' ) ;
348- favicon32 . rel = 'icon' ;
349- favicon32 . type = 'image/png' ;
350- favicon32 . setAttribute ( 'sizes' , '32x32' ) ;
351- favicon32 . href = 'assets/favicon-32x32.png' ;
352-
353- document . head . appendChild ( favicon16 ) ;
354- document . head . appendChild ( favicon32 ) ;
332+ this . setDefaultFavicon ( ) ;
355333 }
356334 } ) ;
357335 this . _uiSettings . getUiSettings ( ) . subscribe ( ( settings ) => {
@@ -406,4 +384,27 @@ export class AppComponent {
406384 }
407385 } ) ;
408386 }
387+
388+ private setDefaultFavicon ( ) {
389+ const faviconIco = document . createElement ( 'link' ) ;
390+ faviconIco . rel = 'icon' ;
391+ faviconIco . type = 'image/x-icon' ;
392+ faviconIco . href = 'assets/favicon.ico' ;
393+
394+ const favicon16 = document . createElement ( 'link' ) ;
395+ favicon16 . rel = 'icon' ;
396+ favicon16 . type = 'image/png' ;
397+ favicon16 . setAttribute ( 'sizes' , '16x16' ) ;
398+ favicon16 . href = 'assets/favicon-16x16.png' ;
399+
400+ const favicon32 = document . createElement ( 'link' ) ;
401+ favicon32 . rel = 'icon' ;
402+ favicon32 . type = 'image/png' ;
403+ favicon32 . setAttribute ( 'sizes' , '32x32' ) ;
404+ favicon32 . href = 'assets/favicon-32x32.png' ;
405+
406+ document . head . appendChild ( faviconIco ) ;
407+ document . head . appendChild ( favicon16 ) ;
408+ document . head . appendChild ( favicon32 ) ;
409+ }
409410}
0 commit comments