I have come across this several times, and there is no explanation for this. There were no JS errors on the site. The code is actually executing. Replacing them with alert() works just fine.
So, today it happened again, so I tried to check the console object in the console object, and found some violations, as if something was overwriting the console object.
The following screenshot of the site (site A) where I have this problem:
http://ompldr.org/vZ256Mw/Selection_004.jpg
Do you see how the log, warning and information are empty functions? and the console object is different from how it is on the site (site B), where does the console work (screenshot follows)?
http://ompldr.org/vZ256Mg/Selection_003.jpg
Now the code running on both sites is exactly the same. Site B is my local installation, and Site A is the staging, and I have nothing in the code that overwrites the console object, so what could be the explanation for this behavior?
As per the nfroidure suggestion, I added this code in the “My section” section before anything else, and I got this: uncaught error! (anonymous function) (anonymous function) uncaught error! (anonymous function) (anonymous function) , the second of which points to code in another library file that has the following in it:
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 is responsible because I think the if check is wrong. "console" in window will be true, and "firebug" in window will be false for me in Chrome, which will lead to a replacement of the console methods. There should be && , no?
Update: After changing the operator to && it started working on site A, but I don’t understand why it runs only on one and not on the other.