For anyone who is interested in blocking their site off – a concern is that an iframe can be used to include pages on your website into external sites. So to prevent people hotlinking your site’s webpages through iFrames simply include this script at the top of your pages.
Also see related posts:
JQUERY CHECK IF WINDOW IS IN IFRAME
JQUERY RELOAD AN IFRAME
GETTING THE SRC OF AN INJECTED IFRAME WITH JQUERY
<!--
if (top.location!= self.location) {
top.location = self.location.href
}
//-->
Sam Deering
View AuthorSam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.
jQuery
Share this article