I stumbled onto an interesting pattern when checking out the Mellow Mushroom web page. It didn't hit me right away ... I left the page and had to come back and see if I really had observed the page title change when I switched tabs! Then, I had to figure out how it was done.
A quick search came up with the following question on Stack Overflow ... PERFECT!
So I am making a website and everything is nicely done but I don't know that many things with javascript.
I was searching for something that will help me with this and found some similar things but it doesn't work in my case.
This is the problem/idea:
- User is on…
In the answers ...
window.onblur = function () {
document.title = 'you left?';
}
window.onfocus = function () {
document.title = 'WELCOME';
}
Here's a working copy of the code above ...