Why does this window object not have the eval function?

Posted by Motti on Stack Overflow See other posts from Stack Overflow or by Motti
Published on 2010-04-27T10:39:37Z Indexed on 2010/04/27 10:43 UTC
Read the original article Hit count: 330

I ran into an interesting (?) problem in the YUI rich edit demo on IE. When looking at the window object for the content editable frame used as the browser I see that the eval function is undefined (by running the following).

javascript:alert(document.getElementById("editor_editor").contentWindow.eval)

This only happens on IE (I checked on IE6 and IE8), and it doesn't happen on Firefox or Chrome.

All the other window functions and properties seem to be in order, now I realise that eval is not really defined on the window but on the global object but my understanding was that in browsers the window is the global object (also eval does appear on all other windows so why not on this one?).

Does anyone know if this is a know bug/limitation in IE and how I can get to eval in the context of the global object of this frame? (I need the side effects to be available to anything running from within this frame).

© Stack Overflow or respective owner

Related posts about internet-explorer

Related posts about JavaScript