Page title notifications switch between the default page title and a notification message continously in order to grab the user’s attention. This is commonly used with chat applications.

newchatmessage

I’ve written a small javascript object which can be used to switch on and off page title notifications.

To activate the page title notification call the following:

PageTitleNotification.On("New Chat Message!");

Then call the following to turn it off:

PageTitleNotification.Off();

The default speed is 1000 milliseconds, but this can be customised by passing a 2nd parameter to the On() function.

PageTitleNotification.On("New Chat Message!", 5000);

Download
To use this download the minified javascript version here:

PageTitleNotification.min_.js

Or you can use the un-minified source code here:

var PageTitleNotification = {
    Vars:{
        OriginalTitle: document.title,
        Interval: null
    },    
    On: function(notification, intervalSpeed){
        var _this = this;
        _this.Vars.Interval = setInterval(function(){
             document.title = (_this.Vars.OriginalTitle == document.title)
                                 ? notification
                                 : _this.Vars.OriginalTitle;
        }, (intervalSpeed) ? intervalSpeed : 1000);
    },
    Off: function(){
        clearInterval(this.Vars.Interval);
        document.title = this.Vars.OriginalTitle;   
    }
}

View Demo
http://fiddle.jshell.net/Curt/w8QBM/show/light/

Hope this comes in help, comment if you have any issues/suggestions!

UPDATE – November 2015

New improved version now available on GitHub.

https://github.com/CurtTimson/Flashing-Page-Title-Notification