<html><head> <script language="JavaScript">
function initialize() { if (sessionExists() == false) {
saveState("Hello World 1"); // some browsers need a bit of a timeout
window.setTimeout("saveState('Hello World 2')", 300);
window.setTimeout("saveState('Hello World 3')", 600); }
} function getIFrameDocument() {
var historyFrame = document.getElementById("historyFrame");
var doc = historyFrame.contentDocument; if (doc == undefined) // Internet Explorer
doc = historyFrame.contentWindow.document; return doc; } function sessionExists() { var doc = getIFrameDocument(); try { if (doc.body.innerHTML == "") return false; else return true; } catch (exp) {
// sometimes an exception is thrown if a
// value is already in the iframe
return true; } }
function saveState(message) {
// get our template that we will
// write into the history iframe
var templateDiv = document.getElementById("iframeTemplate");
var currentElement = templateDiv.firstChild;
// loop until we get a COMMENT_NODE
while (currentElement && currentElement.nodeType != 8) {
currentElement = currentElement.nextSibling; }
var template = currentElement.nodeValue;
// replace the templated value in the
// constants with our new value
var newContent =
template.replace(//%message/%/, message);
// now write out the new contents
var doc = getIFrameDocument();
doc.open();
doc.write(newContent);
doc.close();
} </script></head><body οnlοad="initialize()"> <div id="iframeTemplate">
<!-- <html> <body> <p>%message%</p> </body> </html> -->
</div>
<iframe id="historyFrame"></iframe> </body><html>