How can i prevent direct linking to Frames?

I have a frame set. But people can still access the individual frame addresses without going throught the main frameset.

For example: instead of going to and choosing 'Us' at the top, they can just go directly to

how can i prevent this?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add this to the <body> tag of all the frames to be displayed but not the page with the frameset:

<body onLoad="
var wl = top.window.location + '';
if(wl.indexOf('htm') >= 0)
window.location = ''">

With this code, if the page is accessed normally through a frameset, it will display, but if they type it into their browser URL, it redirects them to the main page with the frameset.
Small change to make it more frames-compatible.

<body onLoad="
var wl = parent.window.location + '';
if(wl.indexOf('htm') >= 0)
parent.window.location = ''">
If you already have some code in your <body> tag, you just need to add this to the <body> tag:

onLoad="var wl = parent.window.location + '';if(wl.indexOf('htm') >= 0) parent.window.location = ''"
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

This works nicely, change the body tags to

<body onload="(top.location != this.location)?true:document.location=''">

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dunkjonesyAuthor Commented:
thankyou very much people....theres probably more than one answer to this, so i just chose the first one i tried (and the one that looked the simplest)

many thanks!
Thanks GfW
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.