Internet Explorer and console.log woes

Facebook
X
LinkedIn

I cannot begin to count the number of hours I have wasted trying to figure out what the hell Internet Explorer is doing. This latest one really threw me for a loop, so I thought I would share what I learned so someone else doesn’t waste the time that I did.

Internet Explorer does not support console.log but you will never know that once you open the Developer Tools!

Internet Explorer 8’s javascript support is less than stellar. Its better than it was, but still far from perfect. If you are like me, you probably develop your apps with a real browser like Chrome, Safari, or perhaps some of  are still using Firefox. Then you run it in IE and hope for the best. So when I finished coding a new release today, everything ran fine in IE so out the door it went.

Sure enough, a few hours later, the client comes back reporting a bug. My javascript was broken but for the life of me I couldn’t find where or why. It turns out that I had gotten lazy and left an unwrapped console.log message in my code. There are a million blogs out there that show you how to safe guard against this for IE  (window.console && console.log && console.log(“foo bar”); ). But I was lazy.

I admit… its partially my fault. But here is why I hate IE – once you open the Developer Tools, console.log is available from that point forward. An end user that has no idea what the Developer Tools are will see code that crashes due to an “Unsupported Object or Property”, essentially a Null Pointer Exception. But as a developer who has used the Developer Tools, everything works fine and dandy. Ugh.

So take heed. Don’t be lazy and leave unchecked console.log messages in your code. If you do, it could cause trouble for your users without you even realizing it.

Like this post? Please share it! Then follow us on Twitter – @thorntech – and sign up for our email list below for future updates.

Related Posts

Try SFTP Gateway Free for 14 Days — No Server to Stand Up, No Credit Card

Trying self-hosted software normally costs you an afternoon before you’ve even decided you want it. Spin up a VM, open the right ports, work through the marketplace listing’s prerequisites, and hope the image boots the way the documentation says it will. That setup tax is

SFTP Gateway 3.9: More Control, Better Performance

A client opens an SFTP connection and never lets go. Maybe it’s a scheduled job that lost its network path mid-transfer, maybe it’s a misconfigured script retrying without backing off; either way, the connection sits open, holding a slot on your server indefinitely. Multiply that

Introducing the SFTP Gateway Product Support Lifecycle

SFTP Gateway now publishes a written Product Support Lifecycle and a Version Support Calendar for every cloud marketplace, so you always know exactly how long your version stays patched, and when. Thorn Technologies is introducing the SFTP Gateway Product Support Lifecycle: a written commitment to