Make browser window blink in task Bar


How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time.

Edit: These users do want to be distracted when a new message arrives.

This question is tagged with javascript browser

~ Asked on 2008-08-31 21:22:51

13 Answers


this won't make the taskbar button flash in changing colours, but the title will blink on and off until they move the mouse. This should work cross platform, and even if they just have it in a different tab.

newExcitingAlerts = (function () {
    var oldTitle = document.title;
    var msg = "New!";
    var timeoutId;
    var blink = function() { document.title = document.title == msg ? ' ' : msg; };
    var clear = function() {
        document.title = oldTitle;
        window.onmousemove = null;
        timeoutId = null;
    return function () {
        if (!timeoutId) {
            timeoutId = setInterval(blink, 1000);
            window.onmousemove = clear;

Update: You may want to look at using HTML5 notifications.

~ Answered on 2008-10-01 04:48:18


I've made a jQuery plugin for the purpose of blinking notification messages in the browser title bar. You can specify different options like blinking interval, duration, if the blinking should stop when the window/tab gets focused, etc. The plugin works in Firefox, Chrome, Safari, IE6, IE7 and IE8.

Here is an example on how to use it:

$.titleAlert("New mail!", {

If you're not using jQuery, you might still want to look at the source code (there are a few quirky bugs and edge cases that you need to work around when doing title blinking if you want to fully support all major browsers).

~ Answered on 2010-10-07 22:50:29


My "user interface" response is: Are you sure your users want their browsers flashing, or do you think that's what they want? If I were the one using your software, I know I'd be annoyed if these alerts happened very often and got in my way.

If you're sure you want to do it this way, use a javascript alert box. That's what Google Calendar does for event reminders, and they probably put some thought into it.

A web page really isn't the best medium for need-to-know alerts. If you're designing something along the lines of "ZOMG, the servers are down!" alerts, automated e-mails or SMS messages to the right people might do the trick.

~ Answered on 2008-10-01 04:34:41


Supposedly you can do this on windows with the growl for windows javascript API:

Your users will have to install growl though.

Eventually this is going to be part of google gears, in the form of the NotificationAPI:

So I would recommend using the growl approach for now, falling back to window title updates if possible, and already engineering in attempts to use the Gears Notification API, for when it eventually becomes available.

~ Answered on 2008-10-01 05:14:58


                var oldTitle = document.title;
                var msg = "New Popup!";
                var timeoutId = false;

                var blink = function() {
                    document.title = document.title == msg ? oldTitle : msg;//Modify Title in case a popup

                    if(document.hasFocus())//Stop blinking and restore the Application Title
                        document.title = oldTitle;

                if (!timeoutId) {
                    timeoutId = setInterval(blink, 500);//Initiate the Blink Call
                };//Blink logic 

~ Answered on 2015-07-24 16:20:54


Why not take the approach that GMail uses and show the number of messages in the page title?

Sometimes users don't want to be distracted when a new message arrives.

~ Answered on 2008-08-31 22:00:47


The only way I can think of doing this is by doing something like alert('you have a new message') when the message is received. This will flash the taskbar if the window is minimized, but it will also open a dialog box, which you may not want.

~ Answered on 2008-08-31 21:34:47


You may want to try window.focus() - but it may be annoying if the screen switches around

~ Answered on 2008-10-01 04:47:39


you could change the title of the web page with each new message to alert the user. I did this for a browser chat client and most users thought it worked well enough.

document.title = "[user] hello world";

~ Answered on 2008-09-01 00:02:59


AFAIK, there is no good way to do this with consistency. I was writing an IE only web-based IM client. We ended up using window.focus(), which works most of the time. Sometimes it will actually cause the window to steal focus from the foreground app, which can be really annoying.

~ Answered on 2008-10-02 02:26:07


These users do want to be distracted when a new message arrives.

It sounds like you're writing an app for an internal company project.

You might want to investigate writing a small windows app in .net which adds a notify icon and can then do fancy popups or balloon popups or whatever, when they get new messages.

This isn't overly hard and I'm sure if you ask SO 'how do I show a tray icon' and 'how do I do pop up notifications' you'll get some great answers :-)

For the record, I'm pretty sure that (other than using an alert/prompt dialog box) you can't flash the taskbar in JS, as this is heavily windows specific, and JS really doesn't work like that. You may be able to use some IE-specific windows activex controls, but then you inflict IE upon your poor users. Don't do that :-(

~ Answered on 2008-08-31 23:03:56


function blinkTab() {
        const browserTitle = document.title;
        let timeoutId;
        let message = 'My New Title';

        const stopBlinking = () => {
            document.title = browserTitle;

        const startBlinking = () => {
            document.title = document.title  === message ? browserTitle : message;

        function registerEvents() {
            window.addEventListener("focus", function(event) { 

            window.addEventListener("blur", function(event) {
                const timeoutId = setInterval(startBlinking, 500);



~ Answered on 2019-08-27 08:22:38


"Make browser window blink in task Bar"

via Javascript 

is not possible!!

~ Answered on 2021-02-13 17:55:56

Most Viewed Questions: