admin管理员组文章数量:1297237
In Google Chrome's Dev tools there's a simple dropdown to choose which window you want to execute your script in:
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.
In Google Chrome's Dev tools there's a simple dropdown to choose which window you want to execute your script in:
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.
Share Improve this question asked Mar 4, 2012 at 19:30 Tom LianzaTom Lianza 4,0724 gold badges43 silver badges50 bronze badges 1- 1 He's asking for a convenience feature in IE.. Hahahaha. Sorry... Had another 4 hour "Damn-IE-is-not-working-while-every-other-browser-is" session today... – nfechner Commented Mar 4, 2012 at 19:33
4 Answers
Reset to default 14It 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.
To follow-up on Ben's answer, that would be
cd([reference])
or
cd(frames[n])
where n
is a valid index in the window.frames array
The feature is now available in IE 11. If you open the dev tools (F12) there's a combo-box in the top right that lets you select the target frame.
(Note: this is on IE 11.0.9600.17728, not sure if every version of IE 11 has it.)
F12 -> script -> choose your page -> console
EDIT:
You can start debug there on java script, add break point and stuff. your keys to run the debugger is like in visual studio.
本文标签: javascriptIs there a way to change frames in the Internet Explorer script consoleStack Overflow
版权声明:本文标题:javascript - Is there a way to change frames in the Internet Explorer script console? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738470383a2088550.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论