将以下代码写到只希望在框架中被浏览的页面中去。
if( window.top == window )
{
 location.href = "框架页面地址";
}

解决方案 »

  1.   

    if(top.location=self.location)top.location="/"
      

  2.   

    没办法,就是得加,如果你有有使用 母版页/include ,那就只需要改一两个地方。
      

  3.   

    try{
    window.top.document;
    }catch(e){
    window.top.location=window.location;
    }
      

  4.   

    <script type="text/javascript">
    //<![CDATA[
    document.write('this is parent: ');
    if(parent==self)
    document.write('true');
    else document.write('false');
    //]]>
    </script>