Click to See Complete Forum and Search --> : escape frames


PhilRey
11-18-2003, 02:23 PM
I am attempting to build my HTML page to validate "strict".

In the past, I have used the base attribute target="_top" to make sure that my page never gets stuck in a page with frames. However, it doesn't validate in "strict".

Is there a way to do this in HTML which will validate?

DaveSW
11-18-2003, 02:28 PM
you could try some javascript like this

http://www.w3schools.com/js/tryit.asp?filename=tryjs_breakout

maybe on the onload event. You might need to modify it to prevent any errors, if there isn't a frame there! I don't know how it would act then, but you could test/modify it.

PhilRey
11-19-2003, 08:52 AM
Thanks, Dave.

But I'm trying to stay strictly with HTML if at all possible.

Any non-javascript solutions out there?

Or should I just stick with base target="_top" ?
(Why won't it validate in strict mode?)

DaveSW
11-19-2003, 09:42 AM
I don't think strict allows the target attribute because it changes the users window - and apparently the user should have the choice of opening a new window or not.

Just out of interest, wouldn't the code you provided make the document open in the top frame and leave the contents of the mainframe?

PhilRey
11-19-2003, 11:04 AM
As far as I know base target="_top" will break free of all frames and display the page in the active window.

For example, if a link to my site is on a page inside a frame, when my page loads it will not open in the frame - it will display in the same window but it is not contained by any frames from the previous site.

Thanks for your response.

DaveSW
11-19-2003, 11:27 AM
Personally I'd have thought _parent was the one needed, but unless you change to a transitional doctype none of them are going to validate anyway. Maybe someone out there knows different tho.
Cheers