JavaScript To Stop Frames
Published by philipnorton42 on Tue, 05/27/2008 - 11:58The following section of JavaScript will detect if anyone is viewing your page in a frame. If they are then the code will redirect them to your site. It essentially stops people using frames to poach your content and stops online proxy software from viewing your site.
1 2 3 | if(top.location != location){
top.location.href = document.location.href;
} |
All you have to do is include this code either in your script tag or your JavaScript includes. Quite a neat little trick really.
Category:
Add new comment