Force a page to always appear in a FRAMESET
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:Our site uses a horizontal frame at the top for navigation. So even if people visited my page through a direct link e.g. from the search engine Google, I want the page to appear in that frameset. How should I do this?
Answer:You check to find out that a page is not framed and then you load the desired frameset:
if (top == window) top.location.href = 'frameset.html';
You can even pass the frame url in the query string e.g.
if (top == window) top.location.href =
'frameset.html?' + escape(window.location.href);
This line has to be in every to-be-framed document on your site.
Then in the main frame page - let's call it frameset.html - you read the query string to get the frame url and afterwards you document.write the frameset. The example below shows how such a Frameset.html file would look like.