javascript - What's the correct way to write to the script console (console.log) in IE? -
i have substitute console.log
defined in document.ready()
:
$(document).ready(function(){ console.log("doc ready"); if(typeof console === "undefined"){ console = { log: function() { } }; } }
i thought ie supposed have function available but, when include call above
console.log("doc ready");
the output appears in firefox console not in ie - in fact ie script execution breaks @ point.
what's correct way write console in ie?
the script-execution breaks because of wrong order of instructions, may better:
$(document).ready(function(){ if(typeof console === "undefined"){ console = { log: function() { } }; } console.log("doc ready"); }
if first access console before checking if exists(and creating if not), results error.
Comments
Post a Comment