dunkjonesy
asked on
How can i prevent direct linking to Frames?
Hi,
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 http://www.citizenerased.com and choosing 'Us' at the top, they can just go directly to http://www.citizenerased.com/pages/us.html
how can i prevent this?
Cheers
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 http://www.citizenerased.com and choosing 'Us' at the top, they can just go directly to http://www.citizenerased.com/pages/us.html
how can i prevent this?
Cheers
Small change to make it more frames-compatible.
<body onLoad="
var wl = parent.window.location + '';
if(wl.indexOf('htm') >= 0)
parent.window.location = 'http://www.citizenerased.com'">
<body onLoad="
var wl = parent.window.location + '';
if(wl.indexOf('htm') >= 0)
parent.window.location = 'http://www.citizenerased.com'">
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 = 'http://www.citizenerased.com'"
onLoad="var wl = parent.window.location + '';if(wl.indexOf('htm') >= 0) parent.window.location = 'http://www.citizenerased.com'"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!
many thanks!
Thanks GfW
<body onLoad="
var wl = top.window.location + '';
if(wl.indexOf('htm') >= 0)
window.location = 'http://www.citizenerased.com'">
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.