Now this is a very old practice that was probably popular some 5 years ago. Blinking / flashing your page title. But the thing is that I had to use it yesterday for a chat page. Every time a new message arrives we wanted to catch the users attention. So thats where it helps.
Where can you see the Title text blinking?
- If you have the page open your Title will blink. Either switch between two messages or One Blank and One Message switching.
- if you have that page open in a tab the you will see some text blinking on the tab name.
- If the window is minimised with the page in question as the active tab then you can see the text in the taskbar tab blinking.
- If you are using windows 7 then you need to point to your browser icon on task bar to see the blinking happening.
Here is the code.
defaultmsg=document.title
// functions to blink the title of the page with a message
function blinkmsg(message, count) {
blinkingmsg(count, message, true);
}
function blinkingmsg(count, message, blink){
if(blink){
document.title=message;
} else {
document.title=defaultmsg;
count-- // decrement the number of times left to blink
}
if (count > 0) {
blinkTimer = setTimeout("blinkingmsg("+count+", '"+message+"', "+!blink+")", 800);
}
}
function test()
{
setInterval('blinkmsg("drink.", 3)', 2000);
}
Now the above code will do three title flashes in 2000, miliseconds or 2 seconds. So you can do the calculation as per your needs. Do not bug the user too much. Thats not a good idea. Plus setTimeOut will use quite a bit a CPU time I suppose because of constant need to check and execute.
Use the Code well and let me know if anything is not upto your expectation.
Hmnn thats a a useful little trick. I remember how we used to do it in HTML classes. LOL