java菜鸟001 2017-04-19 03:33 采纳率: 0%
浏览 1652
已结题

关闭子窗口自动刷新父级窗口

    先执行
    document.location.replace = “/”;
    在执行
     window.opener.location.href=window.opener.location.href;   
     window.close();

    IE支持这种写法 
    其他浏览器没有执行document.location.replace = “/”; 执行了
    window.opener.location.href=window.opener.location.href;   
     window.close();
  • 写回答

3条回答 默认 最新

  • 斯洛文尼亚旅游 2017-04-19 03:46
    关注

    repalce是函数。。

    document.location.replace="/"改为document.location.replace("/")

    而且你关闭了窗口还replace干嘛,要先刷新父页再close,replace会发生跳转也可能导致父页刷新的js不执行,刷新要放第一句来执行

         window.opener.location.href=window.opener.location.href;   
    document.location.replace("/")
         window.close();
    
    评论

报告相同问题?