试试这个
<script> 
if (window.top==self){ 
alert('不能打开!');
window.opener="";
window.close();

</script>

解决方案 »

  1.   

    在每个页面中都加入这个...指向你的主页面if (self==top){
      self.location.href="主页面";
    }
      

  2.   

    if window.top==window then window.location="指定显示的页"
      

  3.   

    if(window.top.frames.length>0){
       try{
           opener=null;  //可能是直接打开的页面,不提示直接关闭
       }
       catch(e){} 
       window.close();   //如果没有父窗体则关闭自己
    }