0

I've laid out a site using an iframe for the main content so the header and footer wouldn't reload with each page turn. However when navigating back to the site using History, only the center content from the iframe loads [w/out header footer]. Is there a way to code these pages so that they load inside the index document if called explicitly? Or is the only answer to redesign the page without iframes somehow? I can link to the test page if necessary.

3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by Airshow
0

In your pages that should be in your iframe

<script type='text/javascript'>
<!--
if(self.location==top.location) top.location.replace('http://mysite.com?frame=' + self.location) ;
-->
</script>

I dunno what the form for html shtml pages is, never thought about it before but in php

<iframe src="<?php if(!$frame) {echo 'main.html';} else {echo $frame; } ?>" frameborder='0' width='100%' height='900'></iframe>
0

Revata,

I'd recommend route 'B'. Redisign your pages to serve them complete with header and footer each time.

Many many sites do this and the overhead is generally minimal because (a) any graphical content (jpegs/gifs/pngs) is cached by all modern browsers and (b) the text component (which will be reserved) is generally small in comparison to images and the rest of the page. Oh yes, put javascript functions and CSS in separate files so they too can be cached.

To save having to code your headers and footers on every page, you need something server-side to build the page dynamically. Any of [ssi | php | jsp | asp] will do the job. With a little imagination you can even build headers and footers client-side in Javascript. I have done that before.

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.