What you have to beware of if the Search Engine selects that main page
that when the page is viewed in isolation from the other frame or
frames, that there is some information which will link that page to
your main website, such as a 'Home' link.
The other alternative is to paste a bit of JavaScript into the 'main'
page, so that if the 'Main' frame is selected by the 'search' then the
complete website will open due to the JavaScript instruction, not just
the page which appears in the 'Search' results.
If you want to use the script (which won't work with the minority who
have JavaScript disabled) it's below. Paste it after the </title> tag
but before the <body> tag.
<script language="JavaScript">
if (parent.location.href == self.location.href){
window.location.href = 'index.html'
}
</script>
I wouldn't call that an "alternative." It will result in the user landing
on the site's home page when he follows the search engine link. Since the
home page is unlikely to contain the material he was searching for, he now
has to dig through the site to find it, and probably will just give up. If
I search for something, I expect to land on a page that contains that
something, and I really doubt that I'm alone in that expectation.
You might want to look up the history of an old Internet protocol called
Gopher, and look at the reasons why the WWW rendered it all but obsolete.
If you do that, you'll find that one of the most important of those reasons
was that there was no way to address a resource linked deeply in a "site";
you always had to start with the opening "page" and drill down. One of the
reasons "purists" object to frames is that they effectively move the WWW
backwards into Gopher territory.
What you *could* do is have a server-side script that would take the URL of
a content page as a parameter and generate a frameset that specified it.
Then the client-side script could say, e.g.
window.location.href = '
http://www.mysite.com/framegen.php?' +
self.location.href;
But that's only easy if all the content pages have the same frame
structure, and it's still a problem for those with Javascript disabled or
blocked (due to the security problems reported with MSIE's Javascript
implementation, it's likely that in an increasing number of corporate
environments Javascript will be enabled on the browsers so intranet
applications can use it, but filtered out by the firewall when pages are
fetched from outside).