escape frames

liunx

Guest
I am attempting to build my HTML page to validate "strict".<br />
<br />
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".<br />
<br />
Is there a way to do this in HTML which will validate?<!--content-->you could try some javascript like this<br />
<br />
<!-- m --><a class="postlink" href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_breakout">http://www.w3schools.com/js/tryit.asp?f ... s_breakout</a><!-- m --><br />
<br />
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.<!--content-->Thanks, Dave.<br />
<br />
But I'm trying to stay strictly with HTML if at all possible.<br />
<br />
Any non-javascript solutions out there?<br />
<br />
Or should I just stick with base target="_top" ?<br />
(Why won't it validate in strict mode?)<!--content-->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.<br />
<br />
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?<!--content-->As far as I know base target="_top" will break free of all frames and display the page in the active window.<br />
<br />
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.<br />
<br />
Thanks for your response.<!--content-->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.<br />
Cheers<!--content-->
 
Back
Top