Live Page Embedding

by pieterh on 12 Nov 2009 13:38

The new cross-site includes feature lets you include the source of one page into another. We're finding lots of use for this powerful extension to normal includes, which used to work only inside one site. I'm going to show you a simple way of getting a live 'view' of another page.

Here, for example, is a page describing the design of a new feature for embedding HTML directly into a page.

Originally suggested by pieterhpieterh on 13 October 2009.

This is a design sketch for embedding HTML into Wikidot pages. The idea is based on the design of an Iframe module by James KanjoJames Kanjo.

We propose a syntax extension:

[[html ...arguments...]]
<h1>
    My example header
</h1>
<p>
    My awesome paragraph.
</p>
[[/html]]

This creates an HTML page on a separate server, creates an iframe to embed that HTML page into the current page, and adds JavaScript that automatically resizes the iframe to match the HTML size.

This is a secure sandboxing of the HTML: it cannot access the encapsulating page nor can it use the session's security information.

The code for this is:

[[div style="border: 1px solid grey; padding: 1em; background:white"]]
[[include :projects:thread:131]]
[[/div]]

Comments: 9

Add a New Comment