As observed by djr33, you can apply a technique that uses the query string portion of the url. Here's an example.
In index.html:
Code:
<head>
<script type="text/javascript">
/*Loading a new file in the iframe each time we go to a new page */
var object_url = "page1.html"; //starting iframed page; adapt to your needs
var content = (location.search) ? location.search.substring(1, location.search.length) : object_url;
function load_iframe() {
top.ifr.location.replace(content)
}
window.onload=load_iframe
</script>
<script type="text/javascript">
/* This function will be used in index.html (containing your menu and the iframe). Links in index.html:
href="javascript: load('page1.html')", href="javascript: load('http://www.google.com')" etc. */
function load(which)
{
location.href='?'+which
}
</script>
</head>
<body>
<!-- This represents your menu -->
<a href="javascript: load('page1.html')">Home (page 1)</a>
<a href="javascript: load('page2.html')">page2</a>
<a href="javascript: load('http://www.google.com')">Google</a><br>
<iframe name="ifr" style="your styles for the iframe"></iframe>
</body>
</html>
In all other pages:
Code:
<head>
<script type="text/javascript">
function orph(){//prevent pages from being orphaned
if (top.location == self.location)
top.location.href="index.html?" + document.URL
}
window.onload=orph;
/* This function will be used in the pages that are loaded in the iframe.
href="javascript: load('page1.html')", href="javascript: load('http://www.google.com')" etc. */
function load(which)
{
top.location.href='index.html?'+which
}
</script>
</head>
<body>
Bla
</body>
Arie Molendijk.
Bookmarks