mozilla

Revision 590197 of iframe

  • Revision slug: Mozilla/Tech/XUL/iframe
  • Revision title: iframe
  • Revision id: 590197
  • Created:
  • Creator: billmccloskey
  • Is current revision? Yes
  • Comment

Revision Content

{{ XULRefElem() }}

An inner frame that works much like the HTML iframe element. The {{ XULAttr("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.

Currently, XUL iframes running in remote processes are not supported. If you want to run content in a remote process, use a XUL browser element.

Warning: When used in Chrome-priviledged documents (either html or xul) such as Firefox addons, the contents of the frame may have the same permissions as Firefox itself. This can be a serious security vulnerability, for example if you use src="http://...". When used in this case, please see Displaying web content in an extension without security issues.

More information is available in the XUL tutorial.

Attributes
{{ PrefAnch("a-", "showcaret") }}, {{ PrefAnch("a-", "src") }}, {{ PrefAnch("a-", "browser.type", "type") }}, {{ PrefAnch("a-", "transparent") }}
Properties
{{ PrefAnch("p-", "accessibleType") }}, {{ PrefAnch("p-", "contentDocument") }}, {{ PrefAnch("p-", "contentWindow") }}, {{ PrefAnch("p-", "docShell") }}, {{ PrefAnch("p-", "webNavigation") }}

Examples

<iframe src="table.php" flex="2" id="browserTable" name="table_frame"/>

Selecting an URL from a menu

<menulist oncommand="doNav(this);">
  <menupopup>
    <menuitem label="Mozilla" value="http://mozilla.org" />
    <menuitem label="Slashdot" value="http://slashdot.org"/>
    <menuitem label="Sourceforge" value="http://sf.net" />
    <menuitem label="Freshmeat" value="http://freshmeat.net"/>
  </menupopup>
</menulist>


<iframe id="myFrame" flex="1"/>

<script>
function doNav(obj) {
  var url = obj.selectedItem.value;
  // note the firstChild is the menupopup element
  document.getElementById('myFrame').setAttribute('src', url);
}
</script>

Attributes

{{ XULAttrInc("showcaret") }}{{ XULAttrInc("src") }}{{ XULAttrInc("browser.type") }}{{ XULAttrInc("iframe.transparent") }}{{ XULAttrInheritedWide() }}

Properties

{{ XULPropInherited() }}{{ XULPropInc("accessibleType") }}{{ XULPropInc("contentDocument") }}{{ XULPropInc("contentWindow") }}{{ XULPropInc("docShell") }}{{ XULPropInc("webNavigation") }}

Methods

{{ XULMethInheritedWide() }}

Interfaces
{{ interface("nsIAccessibleProvider") }}

{{ languages( { "de": "de/XUL/iframe", "ja": "ja/XUL/iframe", "pl": "pl/XUL/iframe" } ) }}

Revision Source

<div class="noinclude">
 {{ XULRefElem() }}</div>
<p>An inner frame that works much like the HTML <code>iframe</code> element. The {{ XULAttr("src") }} attribute can be used to specify the content of the frame. This content is a separate document. The children of the <code>iframe</code> are ignored.</p>
<p>Currently, XUL iframes running in remote processes are not supported. If you want to run content in a remote process, use a <a href="/en-US/docs/Mozilla/Tech/XUL/browser">XUL browser element</a>.</p>
<p><strong><span style="color:#b22222;">Warning</span></strong>: When used in Chrome-priviledged documents (either html or xul) such as Firefox addons, the contents of the frame may have the same permissions as Firefox itself. This can be a serious security vulnerability, for example if you use src="http://...". When used in this case, please see <a href="https://developer.mozilla.org/en-US/docs/Displaying_web_content_in_an_extension_without_security_issues">Displaying web content in an extension without security issues</a>.</p>
<p>More information is available in the <a href="/en/XUL_Tutorial/Content_Panels" title="en/XUL_Tutorial/Content_Panels">XUL tutorial</a>.</p>
<dl>
 <dt>
  Attributes</dt>
 <dd>
  {{ PrefAnch("a-", "showcaret") }}, {{ PrefAnch("a-", "src") }}, {{ PrefAnch("a-", "browser.type", "type") }}, {{ PrefAnch("a-", "transparent") }}</dd>
 <dt>
  Properties</dt>
 <dd>
  {{ PrefAnch("p-", "accessibleType") }}, {{ PrefAnch("p-", "contentDocument") }}, {{ PrefAnch("p-", "contentWindow") }}, {{ PrefAnch("p-", "docShell") }}, {{ PrefAnch("p-", "webNavigation") }}</dd>
</dl>
<h3 id="Examples" name="Examples">Examples</h3>
<pre>
&lt;iframe src="table.php" flex="2" id="browserTable" name="table_frame"/&gt;
</pre>
<p>Selecting an URL from a menu</p>
<pre>
&lt;menulist oncommand="doNav(this);"&gt;
  &lt;menupopup&gt;
    &lt;menuitem label="Mozilla" value="http://mozilla.org" /&gt;
    &lt;menuitem label="Slashdot" value="http://slashdot.org"/&gt;
    &lt;menuitem label="Sourceforge" value="http://sf.net" /&gt;
    &lt;menuitem label="Freshmeat" value="http://freshmeat.net"/&gt;
  &lt;/menupopup&gt;
&lt;/menulist&gt;


&lt;iframe id="myFrame" flex="1"/&gt;

&lt;script&gt;
function doNav(obj) {
  var url = obj.selectedItem.value;
  // note the firstChild is the menupopup element
  document.getElementById('myFrame').setAttribute('src', url);
}
&lt;/script&gt;
</pre>
<h3 id="Attributes" name="Attributes">Attributes</h3>
<p>{{ XULAttrInc("showcaret") }}{{ XULAttrInc("src") }}{{ XULAttrInc("browser.type") }}{{ XULAttrInc("iframe.transparent") }}{{ XULAttrInheritedWide() }}</p>
<h3 id="Properties" name="Properties">Properties</h3>
<p>{{ XULPropInherited() }}{{ XULPropInc("accessibleType") }}{{ XULPropInc("contentDocument") }}{{ XULPropInc("contentWindow") }}{{ XULPropInc("docShell") }}{{ XULPropInc("webNavigation") }}</p>
<h3 id="Methods" name="Methods">Methods</h3>
<p>{{ XULMethInheritedWide() }}</p>
<h3 id="Related" name="Related">Related</h3>
<dl>
 <dt>
  Interfaces</dt>
 <dd>
  {{ interface("nsIAccessibleProvider") }}</dd>
</dl>
<p>{{ languages( { "de": "de/XUL/iframe", "ja": "ja/XUL/iframe", "pl": "pl/XUL/iframe" } ) }}</p>
Revert to this revision