Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to change frames in the Internet Explorer script console?

In Google Chrome's Dev tools there's a simple dropdown to choose which window you want to execute your script in:

enter image description here

Is there an equivalent in Internet Explorer? I'm trying to run scripts from the console as if they're from an iframe, not the toplevel window.

like image 368
Tom Lianza Avatar asked Mar 04 '12 19:03

Tom Lianza


1 Answers

It is possible, however it’s significantly less convenient than in Chrome.

If you’re able to get a reference to the frame or its window object (using, e.g.: document.getElementById(xxx).contentWindow), you can use the console’s special cd function. This is documented here: http://msdn.microsoft.com/en-us/library/ie/gg589530(v=vs.85).aspx#UsingCDacrossFrames

Annoyingly, this means that if you want to get a reference to a nested iframe, you have to do this inside each each of the parents of the frame that you’re interested in. Debugging in IE is, erm, fun.

like image 180
Ben Hodgson Avatar answered Oct 01 '22 01:10

Ben Hodgson