zaterdag, 27 augustus, 2011
iWeb : iframe alternative in the HTML Snippet
To display a remote webpage in an iWeb webpage, you use the HTML Snippet with the <iframe> HTML element.
It's a line of code with a lot of attributes :
<iframe src="http://url.to.file.html" frameborder="0" width="500" height="500" scrolling="no" allowTransparency="true"></iframe>
iWeb uses an separate file, widget0-markup.html, to display that remote page.
And since the HTML Snippet itself is an <iframe> it's double.
To avoid that you can use a JavaScript that replaces the widget0-markup.html with another file, be it a webpage or an image.
Here's the code you paste :
<div style="width: 650px; height: 650px">
<script language="JavaScript">
location.replace('../../../your files.html');
</script>
</div>
Use three sets of ../ to escape from the folder with the Sitename if you use a relative URL, Use "/url-to-file", when using a relative to root URL or use an absolute URL to the remote file.
De <div> is used to define the size of the HTML Snippet. It is assumed that the file doesn't have to scroll inside the HTML Snippet. If you want that, you'll have to find a solution for that, or use the <iframe>.
See sample pages here : demo pages...
See also this blog entry : Using the iWeb HTML Snippet