Note: An alternative skin, TW4MW (work in progress), is available from the user preferences.

IFramePlugin

TiddlyWiki Community Wiki

Jump to: navigation, search
Name: IFramePlugin
Author : jayfresh
URL : #IFramePlugin
Description : Provides cross-browser methods for working with iframes
Version : 1


Installing the IFramePlugin allows you to work with iframes in your TiddlyWiki across different browsers. It provides you with the following constructor:

  • IFrame

and the following method for an IFrame instance

  • modify

Contents

[edit] IFrame constructor

[edit] Usage

var ifr = new IFrame(parentElem);

where "parentElem" is an optional DOM element to add the iframe as a child to; parentElem defaults to document.body.

This adds an iframe to the page body and sets a doc property to allow DOM operations such as:

ifr.doc.documentElement.innerHTML = "...";
ifr.doc.documentElement.getElementsByTagName("body")[0].appendChild(textNode);

NB: appending the iframe to document.body leaves the iframe without a provided way to close it

[edit] modify

[edit] Usage

ifr.modify(html);

where html is a text string to become the content of the iframe.

[edit] Description

This method replaces the content of the iframe with the suppled string. The function was created to expect a full HTML page, and currently only outputs that which is contained in <HEAD> or <BODY> tags.

Personal tools