firebug:如何cd到iframe

Kal*_*dae 64 iframe firebug facebook

我有一个在iframe中运行的facebook canvas应用程序.我想在firebug中调试我的页面,但无法将javascript范围扩展到运行我的应用程序的iframe.

iframe:

<iframe frameborder="0" src="[app_url_removed]" name="iframe_canvas" id="iframe_canvas" class="canvas_iframe_util" style="height: 905px;"></iframe>
Run Code Online (Sandbox Code Playgroud)

我已经尝试了以下所有内容,但它们都不起作用:

cd(iframe_canvas)
cd(window.iframe_canvas)
cd(iframe_canvas.window)
cd($('iframe_canvas'))
Run Code Online (Sandbox Code Playgroud)

我有firefox 3.6.13,我尝试过firebug 1.7a11和firebug 1.6.2

还尝试了书签和其他各种东西,从这个链接Firebug和iFrame中的jQuery选择器无济于事.

tau*_*oge 104

使用以下命令之一:

 cd(frames[0]) 
 cd(frames["iframe_canvas"])
Run Code Online (Sandbox Code Playgroud)

 cd(top)
Run Code Online (Sandbox Code Playgroud)

返回主窗口.

但是,由于某个错误,目前这种错误不适用于跨域iframe(http://code.google.com/p/fbug/issues/detail?id=3893).有两种测试用例可以测试两种情况下的环境:

另一个可能的惊喜来源:如果您一次执行更多命令,cd命令似乎对以下命令没有影响:

 >>> cd(frames[0]); location.href;
 ["Current window:", Window cdFrame.html]
 "https://getfirebug.com/tests/content/commandLine/cd.html"
 >>> location.href
 "https://getfirebug.com/tests/content/commandLine/cdFrame.html"
Run Code Online (Sandbox Code Playgroud)


Muh*_*uhd 14

在Chrome 中,javascript控制台的底部*有一个下拉列表,可让您切换到不同的框架以执行javascript.还可以跨域工作!

*2014年10月2日更新:在更新版本的Chrome中,此下拉菜单已从控制台的底部移至顶部.