Here's some cut and paste code I did about a year ago that handles what I think you are after. First, the frameset source code:
Code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
var content = "body.htm";
var theRefer = document.referrer;
var okLink = false;
if (theRefer.indexOf(parent.location.host) != -1)
theRefer = "";
if (theRefer == "")
okLink = true;
if (document.cookie != "" && okLink == true && parent.location.href.indexOf('.htm') != -1)
content = document.cookie;
</script>
</head>
<script>
document.write('<frameset rows="105,*,60" frameborder="NO" border="0" framespacing="0" cols="*">');
document.write('<frame name="topFrame" scrolling="NO" noresize src="top.htm" frameborder="NO" >');
document.write('<frameset cols="212,*" frameborder="NO" border="0" framespacing="0" rows="*"> ');
document.write('<frame name="leftFrame" scrolling="NO" noresize src="side.htm" frameborder="NO">');
// This is the line that does the work
document.write('<frame name="mainFrame" src=' + content + ' frameborder="NO">');
// This is the line that does the work
document.write('</frameset>');
document.write('<frame name="bottomFrame" src="bottom.htm" scrolling="NO" noresize frameborder="NO">');
document.write('</frameset>');
</script>
<noframes>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</noframes>
</html>
Next, is the sourcecode for 'noframes.js'
Code:
var framesetName = "index2.htm" // Enter the name of your framset page here
if (parent.frames[0] == null){
var foundPointer = false;
var fullUrl = parent.location.href;
if (fullUrl.indexOf(framesetName) == -1)
{
var lengthOfUrl = fullUrl.lastIndexOf('/');
var topicUrl = fullUrl.substring(lengthOfUrl+1);
window.document.cookie = topicUrl;
foundPointer = true
}
if (foundPointer == true)
window.location.href = framesetName;
}
On every page that you want to 'jump into' the frameset, simplay include the 'noframes.js' file
Code:
<script language="javascript" src="js/noframes.js"></script>
You can see this code working at www.medivisuals.com. Visit this page http://www.medivisuals.com/prof.htm to see what happens (no longer at prof.htm, but at frameindex.htm with prof.htm in the contentFrame)
This code is old, so I'm not sure of it's compatiblity from a browser standpoint...
Bookmarks