Asked  7 Months ago    Answers:  5   Viewed   29 times

In which circumstances is window.console.log defined in Internet Explorer 9?

Even when window.console.log is defined, window.console.log.apply and are undefined. Why is this?

[Related question for IE8: What happened to console.log in IE8?.]



In Internet Explorer 9 (and 8), the console object is only exposed when the developer tools are opened for a particular tab. If you hide the developer tools window for that tab, the console object remains exposed for each page you navigate to. If you open a new tab, you must also open the developer tools for that tab in order for the console object to be exposed.

The console object is not part of any standard and is an extension to the Document Object Model. Like other DOM objects, it is considered a host object and is not required to inherit from Object, nor its methods from Function, like native ECMAScript functions and objects do. This is the reason apply and call are undefined on those methods. In IE 9, most DOM objects were improved to inherit from native ECMAScript types. As the developer tools are considered an extension to IE (albeit, a built-in extension), they clearly didn't receive the same improvements as the rest of the DOM.

For what it's worth, you can still use some Function.prototype methods on console methods with a little bind() magic:

var log =, console);
log.apply(console, ["this", "is", "a", "test"]);
//-> "thisisatest"
Tuesday, June 1, 2021
answered 7 Months ago

There's an IE polyfill for the CustomEvent constructor at MDN. Adding CustomEvent to IE and using that instead works.

(function () {
  if ( typeof window.CustomEvent === "function" ) return false; //If not IE

  function CustomEvent ( event, params ) {
    params = params || { bubbles: false, cancelable: false, detail: undefined };
    var evt = document.createEvent( 'CustomEvent' );
    evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
    return evt;

  CustomEvent.prototype = window.Event.prototype;

  window.CustomEvent = CustomEvent;
Saturday, June 12, 2021
answered 6 Months ago

Well i have encountered this same weird behaviour in IE9, it appears to be that IE9 wont do a Drag and Drop (HTML 5 style) on div's. if you would change the div for a A with href="#" you will be able to drag and drop.

this won't drag:

<div data-value="1" class="loadedmodule-container" draggable="true">drag</div>

and this will:

<a href="#" data-value="1" class="loadedmodule-container" draggable="true">drag</a>

Hope this helps anyone

Saturday, June 12, 2021
answered 6 Months ago

You can still use JSONKit in your application with ARC.

I'm using it myself.

Select your project root in XCode 5, under Targets select your application then select the BuildPhases tab. Under Compile Sources double-click JSONKit.m and add the following compiler flags -fno-objc-arc.

Hope it helps


Sunday, August 1, 2021
Angshuman Agarwal
answered 5 Months ago

Or would it be better to let the service run regardless of the phone's status and bind/unbind to/from it when needed.

Please don't. It will just take up RAM for no good reason. It is everlasting services like this that cause users to attack developers with task killers.

Are there any best practices out there regarding the implementation of services?

Here are two of my posts on the subject, for what they're worth.

Tuesday, October 12, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :