window.onload = function(){
 if(parent == null)
 {
   location.href = "index.php";
 }
};

解决方案 »

  1.   

    在 http://domain/main.php 文件<head>中加入以下代码即可跳转;
    <script language="javascript">
    location.href="http://domain/index.php";
    </script>
      

  2.   

    <iframe id="main" src="main.html" ></iframe><script language="javascript">
    function fun()
    {document.getElementById('main').src='index.html';
    }
    </script>调用fun()函数不就可以了吗
      

  3.   

    <script language=javascript>window.onload=function(){parent.window.location.href="index.php";}</script>
      

  4.   

    我综合和在各个网站的求助,最后自己写了这个可以。
    if (location == top.location) 
    top.location.href = "index.php";