Merge pull request #548 from brunoz78/tab-hostname

web: name the browser tab after the switch hostname
This commit is contained in:
René van Dorst authored and GitHub committed 2026-10-11 13:50:09 +00:00
commit 0a996fa6d0
2 files changed
+11 -3

No files matched your search

+5 -1
View File
@@ -1052,7 +1052,11 @@ function renderInfo(){
if(v==null||v==="")return;
tb.appendChild(h("tr",null,[h("td",{class:"mut",text:t(r[0])}),h("td",{class:"mono",text:String(v)})]));
});
if(S.info.hostname)$("brandname").textContent=$("brandname").title=S.info.hostname;
if(S.info.hostname){
$("brandname").textContent=$("brandname").title=document.title=S.info.hostname;
// Remembered per switch (each has its own origin) for the login page tab
try{localStorage.setItem("rtl_host",S.info.hostname);}catch(e){}
}
if(S.info.sw_ver)$("fver").textContent="RTLPlayground "+S.info.sw_ver;
}
function pollInfo(){
+6 -2
View File
@@ -92,8 +92,12 @@ button:hover{filter:brightness(1.1)}
try{l=localStorage.getItem("rtl_lang");}catch(e){}
if(!L[l])l=(navigator.language||"en").slice(0,2);
var s=L[l]||L.en;
document.title=s[0];
document.getElementById("hn").textContent=s[0];
// Name the tab after the switch: the hostname seen at the last login here,
// otherwise the address, so several open switches can be told apart
var host=null;
try{host=localStorage.getItem("rtl_host");}catch(e){}
document.title=(host||location.hostname)+" – "+s[0];
document.getElementById("hn").textContent=host||s[0];
document.getElementById("sub").textContent=s[1];
document.getElementById("lp").textContent=s[2];
document.getElementById("lb").textContent=s[3];