PDA

View Full Version : killframe



mshiva
August 11th, 2006, 20:58
How to use the killframe tag? Please give an example.

Will kilframe kill any type of frames i.e. <iframe> and <frame>

Meksilon
August 12th, 2006, 00:26
killframe auto-generates javascript code, it's not a real tag. The real javascript code to use is:


if(top!=self)self.parent.location=self.location.href;

If you write it like this:


if(top!=self)self.parent.location=self.location.href.replace ('www.','');

Then it will passively push your site from the "www." version, if it's in a frame - resulting in the rather neat and tidy sans-www version. I use .htaccess to prevent people visiting "www.plamdi.com" - which is why if you visit my site, you'll always be pushed to the rather nice http://plamdi.com, sans-www.

Oh and, not many people know this - but you can also design your site to passively break-out-of-frames when people visit with Javascript disabled very easily. If someone visits your site in a frame from another site with javascript disabled, then the javascript code will do noting, because it's not run and your visitor will remain in frames. And when they click on your links, they'll (by default) open within the frame. Well that's because HREF link targets default to "SELF"... but you can change the link target to "TOP" by adding target="_top" to all your link tags... but there's an easier, simpler more effective way that nearly no one knows about to have them default to this behaviour without writing target="_top" in each link tag.


<base target="_top">

Put that between your <head></head> tags. The BASE tag is actually intended for use with frames so that the browser knows which frame to load your links in... I've just used it a more inventive way that results in a passive cross-browser break-out-of-frames without javascript.

mshiva
August 12th, 2006, 01:49
Thank you very much Meksilon