Friday, July 08, 2011

firebug frame - tips

Here are a few tips for using firefox's firebug and frames:

An example of a frameset:

screenshot of a frameset rendered in firefox

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "">
<html xmlns="" xml:lang="en" lang="en">
<title>Frameset example</title>
<frameset rows="50%, 50%">
 <frame src="frame1.html" id="frame1" name="frame1"/>
 <frame src="frame2.html" id="frame2" name="frame2"/>

By default firebug is relative to the "window", to make commands relative to a frame instead, you can use the "cd" command in the console pane, for example:


a command typed into firebug command line in firefox

Now when you execute command it will be relative to the window instead.

So for example if you had this code in frame1:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns="">

<script type="text/javascript">
function hello() {


You can run the function in the firebug command line simply by running the function: hello()

an alert box being triggered within a frameset from the outer window via the firebug commandline

Similarly you can also use this alternative syntax to get to the frames:

Back to the default root window

To reference the frame by id

To reference the frame by number

No comments: