Skip to content
premasagar edited this page Sep 13, 2010 · 33 revisions

See the project home page for basic usage.

API Reference

Core methods

$.iframe()

Returns an iframe element, wrapped inside a standard jQuery collection – i.e. $('<iframe></iframe>') – that has been extended with some additional methods (for details on these, see below). This extended collection object is referred to here as an “AppleOfMyIframe” or “AOMI” object.

$.iframe([headContents], [bodyContents], [options], [callback])

All arguments are optional:

  • headContents (string):
    An HTML string to be appended to the iframe document’s <head> element, once the iframe loads.
  • bodyContents (string):
    An HTML string to be appended to the iframe document’s <body> element, once the iframe loads.
  • options (object):
    An object of different options to use when initialising the iframe. See Options.
  • callback (function):
    A function that will be called when the iframe is ready. This fires after the AOMI object’s ‘ready’ event and before its ‘load’ event. See Events.

$(elem).intoIframe()

Replace elements with an iframe, and inject those replaced elements into the iframe’s body.
E.g. $('div#something').intoIframe();

Basic methods

Except where otherwise stated, all methods return the AOMI object itself, to allow method chaining.

body()

Returns the body element of the iframe’s document (as a jQuery collection).

body(contents, [emptyFirst])

  • contents will be appended to the iframe’s <body> element. May be an HTML string, DOM node, jQuery collection, or selector.
  • emptyFirst is an optional boolean (default false). If true, the body element will first be emptied of all child nodes.

head()

  • contents will be appended to the iframe’s <head> element. May be an HTML string, DOM node, jQuery collection, or selector.
  • emptyFirst is an optional boolean (default false). If true, the head element will first be emptied of all child nodes.

$()

doctype()

document()

window()

location()

contents()

title()

style()

resize()

Event methods

load()

ready()

State methods

isSameDomain()

hasExternalDocument()

hasBlankSrc()

Modified jQuery collection methods

bind()

unbind()

one()

trigger()

live()

die()

Advanced methods

restore()

iframeLoad()

init()

args()

options()

reload()

clone()

replace()

repaint()

Clone this wiki locally