zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

JS 页面 判断 当前 窗口 顶级
2023-09-11 14:15:07 时间
<script>  
    if(top.location!=self.location){  
        alert("不是顶层窗口");
    }else{  
        alert("是顶层窗口");
    }  
</script>  

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