jQuery iFrame - iFrame Loader Demo
Demo
API
$("iframe").src(url, optionalCallback, options);
$("iframe").squirt(html, optionalCallback, options);
Options are:
- timeout will be called some time (according to timeoutDuration) after the iframe started loading, if the iframe hasn't yet finished loading. Use "this" to access iFrame. (Note: If you want to abort loading on timeout, you should do it manually in this function, e.g. "this.src=null".)
- timeoutDuration Timeout duration, used in conjunction with options.timeout. (Defaults to 60000, i.e. one minute.)
Caveats
- Due to cross-domain restrictions, "squirt" can only be used with an iframe whose source is either null or pointing to the same domain as the parent document.
Usage
$("<iframe/>").src("http://google.com").appendTo("body");
$("iframe").squirt("a <em>little</em> content");
$("iframe").src("http://google.com", function(iframe, duration) {
alert("That took " + duration + " millis.");
}, {
timeout: function() { alert("oops! timed out."); },
timeoutDuration: 10000
});