Software Programming posted on January 28, 2010 08:01
How to break out of an iframe from a form or link on your website
To break out of an iframe from a link or a form use this attribute on the.
target="_top"
as in
<a target="_top"
<form target="_top"
What if you do not have access to the code within the iframe?
Saw this suggestion that you might try to change the links within the iframe through the main document. Do not know if this would work. Have not tried it.
with (top.aframe.document) {
for (var i=0; i<links.length; i++) {
links[i].target = "_top"
}}
How to prevent your website from being included in an iframe
Use this code at the top of each of your pages.
<script type="text/javascript">
<!--
if (top.location!= self.location) {
top.location = self.location.href
}
//-->
</script>