David said:
Hi,
My website uses frames and one should always load the frameset and not
only one of the frames. Is there a nice way to ensure/check that a
page is actualy loaded within a frameset?
Well, if you must use frames...
Putting the following in the head of your pages will mean that, in the event
of a frame being loaded without the frameset, the page will default to
index.html. Whilst this doesn't give the visitor the framed page that they
were expecting, it does give them a complete frameset with a menu so that
they can at least navigate the site.
<script language="javascript">
if (document.location == top.location)
{
document.location="index.html";
}
</script>
I'd also suggest that there are lots of ways of getting rid of frames - the
"I want to have the same menu on every page without repeating it" is the
benefit that I hear most often and that's easily solved with includes:
http://www.bignosebird.com/sdocs/include.shtml
HTH