firebug:如何cd到iframe [英] firebug: how to cd to an iframe

查看:139
本文介绍了firebug:如何cd到iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a facebook canvas application that runs in an iframe. I would like to debug my page in firebug but can not get the javascript to scope to the iframe that is running my app.

iframe:

<iframe frameborder="0" src="[app_url_removed]" name="iframe_canvas" id="iframe_canvas" class="canvas_iframe_util" style="height: 905px;"></iframe>

我已经尝试了以下所有操作,但没有一个工作:

i've tried all the following and none of them work:

cd(iframe_canvas)
cd(window.iframe_canvas)
cd(iframe_canvas.window)
cd($('iframe_canvas'))

我有火狐3.6.13
我尝试过firebug 1.7a11和firebug 1.6.2

I have firefox 3.6.13 and I have tried firebug 1.7a11 and firebug 1.6.2

还尝试了来自此链接的书签和各种其他内容 iFrame中的Firebug和jQuery选择器无济于事。

also tried the bookmarklet and various other things from this link Firebug and jQuery selectors in an iFrame to no avail.

推荐答案

使用以下命令之一:

 cd(frames[0]) 
 cd(frames["iframe_canvas"])

 cd(top)

返回主窗口。

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

Still, due to a bug this currently doesn't work on cross-domain-iframes (http://code.google.com/p/fbug/issues/detail?id=3893). There are two test cases where you can test your evironment for both cases:

  • https://getfirebug.com/tests/content/commandLine/cd.html (same domain, works for me: FF 3.6.13, FB 1.6.2)
  • http://getfirebug.com/tests/issues/3893/issue3893.html (cross domain, fails)

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

Another possible source of surprise: if you execute more commands at once the cd command seems to not have an effect for the directly following commands:

 >>> 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"

这篇关于firebug:如何cd到iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆