How to change Browser-Tab-Title independent from Application title in WAB Developer Edition

285
2
Jump to solution
12-15-2021 06:19 AM
AndreasEugster
New Contributor III

Hi

I'm working with WAB-Developer Edition 2.22.

I have a WAB-App downloaded and deployed on a server and would like to change the browser-tab-title independet from the WAB-Title.

Rightnow in the config.json the WAB-title is defined as "title": "123456". I would like to set the Browser-Tab-Label as "ABCDEFG" independet from the WAB-Title "123456".

Changing the title to <title>ABCDEFG</title> in the index.html does not work - loading the page will first show the Browser-Tab-Label as "ABCDEFG" but then quickly change the Browser-Tab-Label to "123456". Inspecting the html head with browser-developer-tool showes <title>123456</title>. So I guess the index.html configuration is overwritten by the title set in the config.json ?!

Is there a way to interfere / decouple ?

AndreasEugster_4-1639577527250.png

AndreasEugster_3-1639577518804.png

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
MichaelLev
Occasional Contributor III

@AndreasEugster ,

I also use WAB Developer Edition 2.22

What I did -

In config I added a new item "titleBrowserTab" and set it to the browseer tab title I want,

and in jimu.js/ConfigLoader.js lines 223 to 224 I changed 

from:

if(appConfig.title){
  document.title = jimuUtils.stripHTML(appConfig.title);

to:

if (appConfig.titleBrowserTab){//mlev_modified. was appConfig.title
  document.title = jimuUtils.stripHTML(appConfig.titleBrowserTab);

View solution in original post

2 Replies
MichaelLev
Occasional Contributor III

@AndreasEugster ,

I also use WAB Developer Edition 2.22

What I did -

In config I added a new item "titleBrowserTab" and set it to the browseer tab title I want,

and in jimu.js/ConfigLoader.js lines 223 to 224 I changed 

from:

if(appConfig.title){
  document.title = jimuUtils.stripHTML(appConfig.title);

to:

if (appConfig.titleBrowserTab){//mlev_modified. was appConfig.title
  document.title = jimuUtils.stripHTML(appConfig.titleBrowserTab);

AndreasEugster
New Contributor III

@MichaelLev,

Many thanks, that's exactly what I was looking for.  

0 Kudos