Home > is undefined > error web is undefined

Error Web Is Undefined

Contents

be down. Please try the request again. Your cache administrator is webmaster. Generated Sat, 15 Oct 2016 02:43:30 GMT by s_ac15 (squid/3.5.20)

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up 'console' is undefined error for Internet Explorer up vote 338 down vote favorite 124 I'm using Firebug and have some statements like: console.log("..."); http://answers.microsoft.com/en-us/ie/forum/ie10-windows_8/webpage-error-undefined/399062e1-4d3c-4f61-b64c-045d4740a060 in my page. In IE8 (probably earlier versions too) I get script errors saying 'console' is undefined. I tried putting this at the top of my page: still I get the errors. Any way to get rid of the errors? javascript internet-explorer internet-explorer-8 firebug share|improve this question edited Oct 31 '13 at 9:11 informatik01 9,27763759 asked Jul 24 '10 at 19:55 user246114 13.4k3382136 4 http://stackoverflow.com/questions/3326650/console-is-undefined-error-for-internet-explorer Use typeof in your if, it will avoid undefined errors: if(typeof console === "undefined") { var console = { log: function (logMsg) { } }; } –Flak DiNenno Feb 4 '13 at 23:19 14 console.log() only works when IE's dev tool is open (yes IE is crappy). see stackoverflow.com/questions/7742781/… –Adrien Be Jul 16 '13 at 13:14 1 Best answer to that question is stackoverflow.com/a/16916941/2274855 –Vinícius Moraes Nov 19 '13 at 15:05 1 see github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js –Aprillion Nov 27 '13 at 15:54 1 @Aprillion link is broken, use this one instead: github.com/h5bp/html5-boilerplate/blob/master/src/js/plugins‌.js –Alfred Bez Oct 22 '15 at 7:27 | show 2 more comments 21 Answers 21 active oldest votes up vote 349 down vote accepted Try if (!window.console) console = ... An undefined variable cannot be referred directly. However, all global variables are attributes of the same name of the global context (window in case of browsers), and accessing an undefined attribute is fine. Or use if (typeof console === 'undefined') console = ... if you want to avoid the magic variable window, see @Tim Down's answer. share|improve this answer edited May 17 at 8:57 answered Jul 24 '10 at 19:57 kennytm 318k62752812 148 Just to be clear to anyone else using this, place

 

© Copyright 2019|winbytes.org.