Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6369021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:44:59+00:00 2026-05-25T00:44:59+00:00

I was reading about console.log() somewhere on Stackoverflow earlier today, and I remember reading

  • 0

I was reading about console.log() somewhere on Stackoverflow earlier today, and I remember reading that it causes IE to bug out. The user had said that all instances of it should be removed from the code before deployment or a javascript library could be used to omit it in IE.

My question is regarding this second option, how would one write such a library? Would it just be something that’s run onload that affects how the js is parsed from then forward? Like something that says if browser == IE, omit all instances of console.log()… or would it be an extension to the console.log() method that makes it self-aware of what browser it’s being called in? I’m somewhat familiar with extending jQuery functions but have never seen this done with raw js. I’m interested in this because I feel like it would be a good way to achieve browser cross-compatiblity just in general, this isn’t about console.log() specifically.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:45:00+00:00Added an answer on May 25, 2026 at 12:45 am

    There are a few different ways to go about testing for global properties that may or may not exist. You should try to be as defensive as possible, e.g.

    var global = this;
    
    if (!('console' in global)) {
      global.console = {};
    }
    
    if (!('log' in global.console)) {
      global.console.log = /* whatever */;
    }
    

    The in tests could perhaps use typeof instead. The idea is to not use an identifier that may not exist. Perhaps a little saner is:

    // If console exists, declaring it will not hurt
    // If it didn't exist, it does now
    var console;
    
    if (typeof console == 'undefined') {
      console = {};
    }
    
    if (typeof console.log == 'undefined') {
         console.log = /* whatever */;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I vaguely remember reading something somewhere about using Trace.WriteLine over Console.Out.WriteLine in nUnit possibly
I was reading up about NTVDM.exe as I build a quick test console app
When reading about pipes in Advanced Programming in the UNIX Environment, I noticed that
I was reading about the java.io.Console class in one of the java certification books,
I have been reading about try/finally on MSDN and found out following code. They
I remember reading about a way to develop a Google Chrome extension without constantly
Reading about the G.729 codec , I found this interesting tidbit about Comfort Noise
Reading about the Dispose pattern , I see the documentation repeatedly refer to cleaning
Reading about Kohana templates and saw something I've never seen before: $this->template->title = __('Welcome
Reading about Django, I saw this: http://docs.djangoproject.com/en/1.1/ref/contrib/admin/#ref-contrib-admin - the fancy simple to use admin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.