Title - a javascript snippet to control the document title

22 August 2011   0 comments   Javascript

Mind That Age!

This blog post is 7 years old! Most likely, its content is outdated. Especially if it's technical.

This is a piece of Javascript code I use on Kwissle to make the document title change temporarily. Other people might find it useful too.

Code looks like this:

var Title = (function() {
 var current_title = document.title
   , timer;

 return {
    showTemporarily: function (msg, msec) {
      msec = typeof(msec) !== 'undefined' ? msec : 3000;
      if (msec < 100) msec *= 1000;
      if (timer) {
        clearTimeout(timer);
      }
      document.title = msg;
      timer = setTimeout(function() {
        document.title = current_title;
      }, msec);
    }
 }
})();

Demo here

Comments

Your email will never ever be published


Related posts

Previous:
EmailInput HTML5 friendly for Django 02 August 2011
Next:
Reciprocal lesson about gender perspectives 02 September 2011
Related by Keyword:
TornadoGists.org - launched and ready! 06 April 2011
The importance of the TITLE attribute 23 April 2008
Related by Text:
Be very careful with your add_header in Nginx! You might make your site insecure 11 February 2018
jQuery and Highslide JS 08 January 2008
I'm back! Peterbe.com has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
I'm Prolog 01 May 2007