如何在chrome开发人员工具中CD到iframe或chrome中的firebug lite? [英] How do I cd into an iframe in chrome developer tools or firebug lite in chrome?

查看:135
本文介绍了如何在chrome开发人员工具中CD到iframe或chrome中的firebug lite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试cd时,控制台会显示未定义cd"

when I try cd, console says "cd is not defined"

推荐答案

是的,您是正确的Firebug拥有此出色的命令.我很喜欢.这使得使用iframes进行唤醒变得更加容易.就我个人而言,我之所以不会去Firefox是因为它可以使用cd(),因为我也可以使用chrome dev工具中的cd做任何事情.

Yes, you are right Firebug have this awesome command. I really like it. It's making wotking with iframes much easier. Personally I don't go to Firefox just because the cd() is available in it because I can do whatever I can do with cd in chrome dev tools too.

只需在命令提示符下使用contentWindow关键字即可访问iframe window对象.然后,您将可以很好地访问任何函数和变量.

Just use contentWindow keyword in your command prompt to access the iframe window Object. Then you will be good to access any function and variable out there.

例如,我的iframe中有一个通常无法通过控制台访问的变量.

For example I have a variable in my iframe that is not accessible via console normally.

但是我仍然可以像这样通过contentWindow访问变量:

But still I can access to the variable via contentWindow like this:

theIfraem.contentWindow.secret;

如果要触发函数,请执行以下操作:

If you want to fire a function do this:

theIframe.contentWindow.myfunc();

如果要定义一些变量(最难的一个):

If you want to define some variables(the hardest one):

var script = document.createElement('scrept');
script.innerHTML = "var secret = 'hi'";
theIframe.contentWindow.document.body.appendChild(script);

这是cd()实际执行的操作.我知道它不如Firebugs cd()好.但好消息是 cd()即将进入Chrome

This is what cd() actually does. I know it's not as good as Firebugs cd(). But the good news is cd() is coming to Chrome

这篇关于如何在chrome开发人员工具中CD到iframe或chrome中的firebug lite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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