Translations of this page:

Page with iframe

Creating a page in publish with large iframe area is one of the most popular way displaying content from other website into the intranet. Please find these following guide to achieve this:

1. Empty template

First you need an empty publish template containing just one large editable area. you can make one using code below or alternatively you can download it here

<div>
<txt name="e_content" pub_type="text"></txt> 
</div>
<div name="e_cla_editme" style="font-size:10px; margin-top:10px;"><a href="#" name="e_cla_editme_link">Editme</a></div>

Read How to make Publish Template

2. Create a page using this template

3. Switch to source mode and paste the iframe code. I am using google website http://www.google.com as an example:

<iframe frameborder="0" width="100%" height="800" marginwidth="0" marginheight="0" src="http://www.google.com" id="frame" ></iframe>

Auto height (optional)

You might want to eliminate the vertical scrollbar and making the page automaticaly react to the max height of the page, see example below using javascript and remove “height” value from the iframe.

<iframe id="frame" src="http://www.google.com" width="100%" frameborder="0" marginheight="0" marginwidth="0" ></iframe>
<!-- script to auto adjust height for iframe -->
<script type="text/javascript">
function resizeIframe() {
    var height = document.documentElement.clientHeight;
    height -= document.getElementById('frame').offsetTop;
    
    // not sure how to get this dynamically
    height -= 100; /* whatever you set your body bottom margin/padding to be */
    
    document.getElementById('frame').style.height = height +"px";
    
};
document.getElementById('frame').onload = resizeIframe;
window.onresize = resizeIframe;
</script>
 
help/publish/iframe.txt · Last modified: 07/06/2011 04:49 by mike
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki