console.log

rss

Posted by Sebastian Haugland - Oct 1 ’15 at 02:26

Hi

While devoloping I am using alert to read of varables as I got error when I tried to use console.log is there a subsitute for console.log?

  • rostislav
    rostislav
    Moderator
    Member for: 4 years 7 months 2 days
    #1 by rostislav Oct 1 ’15 at 06:21

    The error probably occurs when your console is not open? SP2010 opens in IE in IE8 compatibility mode, and IE8 doesn't have the console object created unless the console is opened, hence you're getting the error. Add a check to get rid of the errors:

     if (window.console) {
     console.log('your message');
     }
    

    and keep your console open to not miss any messages.

Displaying 1 to 1 of 1 messages