判断是否是顶层窗口(父窗口) 如果不是让其在顶层窗口打开<script type="text/javascript"> if(top.location!=self.location){ top.location.href = self.location.href; } else { // console.log(是顶层窗口) }</script>