Question

Today i received an email regarding “How can i prevent my website load from a frame“? He keep complaints about others site load his website into a frame and pretend the content is their own website. He asking about whether i have a solution for him?

Solution

Yes, We can prevent it by a simple Javascript code. Please copy and paste following code into your body of HTML code.

<SCRIPT LANGUAGE="JavaScript">
if (window != top) top.location.href = location.href;
</SCRIPT>

Above Javascript will detect whether your website is load through frame. If yes, it will redirect it to your website. Hope it help. :)

This article was posted in Javascript category.

Related Posts