判断是否是顶层窗口

判断是否是顶层窗口(父窗口) 如果不是让其在顶层窗口打开
<script type="text/javascript">
if(top.location!=self.location){
top.location.href = self.location.href;
} else {
// console.log(是顶层窗口)
}
</script>
posted @ 2019-08-13 09:23  sosolucky  阅读(415)  评论(0编辑  收藏  举报