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

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

    先执行
    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条回答 默认 最新

  • Go 旅城通票 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();
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试