- Published:February 17th, 2011
- Comments:10 Comments
- Category:Firebug Tip, Planet Mozilla
Firebug command line allows executing JavaScript expressions within context of the current page. Firebug also provides a set of built in APIs and one of them is cd()
.
cd(window)
By default, command line expressions are relative to the top-level window of the page, cd() allows you to use the window of a frame in the page instead.
There is several ways how to use this method. First, let's imagine following page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Console Test Page</title>
</head>
<body>
<iframe id="frameID" name="frameName" src="iframe.html" />
</body>
</html>
<head>
<title>Console Test Page</title>
</head>
<body>
<iframe id="frameID" name="frameName" src="iframe.html" />
</body>
</html>
cd(document.getElementById("frameID").contentWindow);
switch to a frame by IDcd(window.frames[0]);
switch to the first frame in the list of framescd(window.frames["frameName"]);
switch to a frame using by namecd(window.top);
switching back to the top level window
Check the example page online.
See all Firebug tips
10 Comments
[...] Software is hard | Firebug Tip: using command line within an iframe [...]
[...] Software is hard | Firebug Tip: using command line within an iframe [...]
I've always wanted that... thanks!
[...] Software is hard | Firebug Tip: using command line within an iframe [...]
Honza, thanks for sharing this useful tip. Before I had to right click the iframe and choose Display Only This Iframe (or something similar)
[...] Software is hard | Firebug Tip: using command line within an iframe [...]
[...] Software is hard | Firebug Tip: using command line within an iframe (tags: firebug <iframe>) [...]
[...] Software is hard | Firebug Tip: using command line within an iframe [...]
F* YEAH! no more "Load frame in a new tab" 😀
[...] Software is hard | Firebug Tip: using command line within an iframeFeb 17, 2011 … Software is hard | Firebug Tip: using command line within an iframe [...] #2 Medal of Honor: History Channel: Battle For the Pacific Special … [...]