Author: Steven Neiland
Published:

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

As much as we wish it would go away and die quietly in a corner, sometimes you still have to provide at least minimal support for older versions of Internet Explorer.

One of the problems with older IE is that it did not support console functions such as log and group. This would have the nasty consequence of causing your javascript to break if you forgot to take out any of these debugging functions from your code.

To guard against this I include this code snippet in my javascript utility scripts.

if( typeof console == "undefined" ){
      console = {
            log: function() {},
            group: function () {},
            error: function () {},
            warn: function () {},
            groupEnd: function () {}
      };
}

What Do You Think?

Reader Comments

Post a Comment

Comment Etiquette:

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain or appear to be advertisments, will not be published.
  • Comments that appear to be created for the purpose of linkbuilding to commercial sites will be removed.

We are all adults here so play nice.

*
*



Archives Blog Listing

Tag Listing

Learn CF In A Week

Treehouse

 
Fork me on GitHub