Iframe

An inner frame that works much the HTML iframe element. The src attribute can be used to specify the content of the frame. This content is a separate document. The children of the iframe are ignored.

More information about iframe

The iframe element implements the following interfaces:

nsIAccessibleProvider  

Attributes:

src

Properties and Methods:

accessible contentDocument contentWindow docShell webNavigation

Attributes:

src

Type: URL

The URL of the page to appear in the iframe.

Inherited from XUL Element:

align allowevents allownegativeassertions class coalesceduplicatearcs
collapsed container containment context contextmenu
datasources dir empty equalsize flags
flex height hidden id insertafter
insertbefore left maxheight maxwidth menu
minheight minwidth mousethrough observes ordinal
orient pack persist popup position
preference-editable ref removeelement sortDirection sortResource
sortResource2 statustext style template tooltip
tooltiptext top uri wait-cursor width

Properties and Methods:

Inherited from XUL Element:

align
allowEvents
blur
boxObject
boxObject.element
boxObject.getLookAndFeelMetric
boxObject.height
boxObject.screenX
boxObject.screenY
boxObject.width
boxObject.x
boxObject.y
builder
className
click
collapsed
contextMenu
controllers
database
datasources
dir
doCommand
flex
focus
getElementsByAttribute
height
hidden
id
left
maxHeight
maxWidth
menu
minHeight
minWidth
observes
ordinal
orient
pack
persist
ref
resource
statusText
style
tooltip
tooltipText
top
width

Inherited from Element:

addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName

accessible

Type: nsIAccessible

Returns the accessibility object for the iframe.

contentDocument

Type: document

This read-only property contains the document object in the iframe.

contentWindow

Type: window

This read-only property contains the window object in the iframe.

docShell

Type: nsIDocShell

Returns the XPCOM object that implements the iframe's document functionality.

webNavigation

Type: nsIWebNavigation

This read-only property contains the nsIWebNavigation object for the document.

Add a note User Contributed Notes
September 8, 2005, 2:05 pm mwolffhh at gmail dot com
Each IFrame in your document will fire its own onload event when its content has completely loaded. As this event has the habit of bubbling up, the parent window will receive the onload event as many times as there are iframes in the window, plus one for the window itself.

You can stop this from happening by using the event.stopPropagation() method, like this:


<?xml version="1.0" encoding="utf8" ?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>

<window id="MainWindow" title="PressWatch MediaDB"
orient="vertical"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="alert('OnLoad has been fired!!'); ">
<iframe src="http://www.golem.de/" flex="1"
onload="event.stopPropagation();"></iframe>
<iframe src="http://www.ix.de/" flex="1"
onload="event.stopPropagation();"></iframe>
<iframe src="http://www.planet-php.net/" flex="1"
onload="event.stopPropagation();"></iframe>
</window>
October 7, 2004, 10:01 am matth at room41 dot net
What isn't mentioned, and what tripped me up for a while, is that you can't set the src property directly to set the URL of the iframe content, instead you must call the setAttribute("src", newURL) method on the iframe.

Indeed, as there is no src property not to mention ;) - Neil

Copyright © 1999 - 2005 XULPlanet.com