Iframe Breaking: How To Stop Unauthorized Iframing Of Your Content
A visitor to my site once informed me when he clicked on one of my links on Twitter; he was brought to my site with a big popup and a malicious code warning. That’s enough to scare the heck out of someone, so I started doing some testing. There was nothing wrong with my site – the problem was the link.
The link on another site produced a toolbar up top that encouraged people to click on a malicious link while loading my site in an iframe underneath. To most folks, my site could appear to be spreading malicious code. I wouldn’t say I like any site that loads my site within an iframe, so I did what any reasonable geek would do… I loaded up a frame breaker.
Iframing your site is not always malicious, though. We recently shared a tool, Sniply, to add a call-to-action (CTA) to any website link you share. It does this by embedding your entire site in an iframe and applying div over your content with the call-to-action.
<script type=’text/javascript’>
if (top !== self) top.location.href = self.location.href;
</script>