js判断当前页面是顶级窗口

<script>  
    if(top.location!=self.location){  
        alert("不是顶层窗口");
    }else{  
        alert("是顶层窗口");
    }  
</script>  

就是判断 当前这个页面是否嵌套在iframe框架中。

posted @ 2018-05-24 15:06  发疯的man  阅读(3796)  评论(0编辑  收藏  举报