search

Home  >  Q&A  >  body text

javascript - How to close the child page and refresh the parent page in the iframe framework

Something like this

Close the current article and refresh the previous page

高洛峰高洛峰2782 days ago607

reply all(4)I'll reply

  • 滿天的星座

    滿天的星座2017-05-16 13:13:05

    I can’t see where you used iframe and structure, can you explain it more clearly?
    If you close the iframe and refresh the page, you can do it directly through the dom. If it is a different domain, you can do it through cross-domain.
    If you close this tab and refresh another tab, you can use cookie + timing, or storage event to trigger multi-tab communication.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:13:05

    postmessage is very suitable for this scene

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:13:05

    Try the js callback function

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:13:05

    This screenshot looks a lot like the H-ui framework.
    If the iframe you pop up uses layui, you can use it like this:

    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);//关闭当前页
    window.parent.location.replace(location.href)//刷新父级页面
    

    If it pops up using layui:

    window.close();//关闭当前页
    window.parent.location.replace(location.href)//刷新父级页面
    

    Inside this... window.close();//This close can actually be used universally

    window.pranet.Operation();
    This method is also common for operating the parent page. What follows is the same as what you want to do on the parent page

    reply
    0
  • Cancelreply