Hey I want to add this Java Script code to my Wix website so that browser tab title changes when user switches to another tab so please tell me how can I do that.
const tabTittle=document.title ;
window . addEventListener (“blur”,() => {
document.title =“Hey Buddy Come Back”;
});
window . addEventListener (“focus”,() => {
document.title=tabTittle ;
})
Do you have a PREMIUM-Wix-Site?
If not, i think it won’t be possible for you.
Else use a —> CUSTOM-ELEMENT.
hey @russian-dima thanks for suggestion I do have Wix Premium but can you elaborate more it would be very helpfull.
Or try this one…
import wixSeo from 'wix-seo';
// ...
$w.onReady( () => {
wixSeo.setTitle("New Title")
.then( () => {
console.log("title set");
} )
.catch( () => {
console.log("failed setting title");
} );
} );

Tested my last provided code…
import wixSeo from 'wix-seo';
$w.onReady(() => {
wixSeo.setTitle("My-Title-X")
.then(() => {
console.log("title set");
} )
.catch(() => {
console.log("failed setting title");
});
});
RESULT ----> Title of my Site-Tab…

As you can see, changing the TITLE of your page is possible.