有没有办法在javascript控制台中将上下文更改为iframe? [英] Is there a way to change context to iframe in javascript console?

查看:214
本文介绍了有没有办法在javascript控制台中将上下文更改为iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改在webkit开发人员工具/ firebug控制台中执行的javascript的上下文,以执行它在页面上从iframe内部运行的代码。



我知道我可以通过在单独的页面上打开iframe中的页面来实现这一点,但我想运行与父框架交互的代码。

解决方案

Chrome 15允许您更改控制台的范围。在控制台的底部,在清除控制台按钮旁边,有一个菜单显示< top frame> ,它将提供可用框架的列表:





Firefox目前正在开发:

  var frame = document.getElementById(frame1)。contentWindow; 
cd(frame);


I would like to change the context of the javascript executed in the webkit developer tool/firebug console to execute its code like it is running from inside an iframe on the page.

I know I could do this by opening the page in the iframe on a separate page, but I want to run code where it interacts with the parent frame.

解决方案

Chrome 15 allows you to change the scope of the console. On the bottom of the console, next to the clear console button, there is a menu that says <top frame> which will give a list of available frames:

Firefox has a similar feature currently in development:


You can also navigate across frames using the command line:

var frame = document.getElementById("frame1").contentWindow;
cd(frame);

这篇关于有没有办法在javascript控制台中将上下文更改为iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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