在js中,window != top 的作用

在网站的首页加上下面的javascript,就可以把自己的窗口变成是最前端的窗口。可以避免别人把你的网站放在他的iframe中,显示的就是他的网站了,误导浏览者。

<script type="text/javascript">
if (window != top)
top.location.href = location.href;
</script>

posted on 2017-03-24 11:40  自由IT  阅读(436)  评论(0编辑  收藏  举报