Reputation: 83
I want to know how to change the title of the browser and set it to a blinking text when the user opens another tab or just minimizes the browser.
Upvotes: 4
Views: 2879
Reputation: 1848
For blinking the title:
var title = document.title;
var intv = window.setInterval(function () {
document.title = document.title === '' ? title : '';
}, 500);
// call this to stop the blinking
function stopBlink() {
window.clearInterval(intv);
document.title = title;
}
As for doing it on tab switch or minimize, maybe running the code on window.onblur
would work but I'm guessing it can't be done.
Upvotes: 1