Console.log () statements do not appear in Safari error log

I am debugging a Safari-specific javascript problem and cannot get console.logto output to the error log. This is a documented Safari feature (I am using version 4.0.3). However, these statements in my code are simply ignored. What for?

+5
source share
4 answers

Thanks to Breton and SeanJA for their suggestions for testing directly in the console and creating the sample file. Having done this, I realized that console.log actually works in an isolated environment. This made me realize that this should be something special for my development environment. Checking, I found that JavaScript was loaded at an early stage, designed to define a console object for browsers that do not support Firebug.

if (!("console" in window) || !("firebug" in console))
 {
     var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
     "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

     window.console = {};
     for (var i = 0; i < names.length; ++i)
         window.console[names[i]] = function() {}
 }

This was written before Safari implemented a console object for its error window.

I deleted it and now everything is working fine. Thanks guys.

+3
source

Do you use a mac or windows build?

Windows "Develop" men, javascript .

  • snipper
  • *
+1

Firefox , firebug . * . , ?

0

. , - , :

0

All Articles