drkbpwk609294 2014-11-28 06:27
浏览 23
已采纳

通过其他页面重新加载帧

i have a page that contain iframe. enter image description here

when user click on the edit icon open new windows for edit this image enter image description here

enter image description here

when finished edit image click on the save.

now how can refresh ifram(first image) to update images that edited?

there is way in jquery or php for do it? or me should use web socket?

i can refresh pages that call editor with this code but i want reload frame only.

    <script language="javascript" type="text/javascript"> 
      window.open(\'\',\'_parent\',\'\');window.close();
   </script>

Sorry me for bad english.

  • 写回答

1条回答 默认 最新

  • duancui19840401 2014-11-28 07:11
    关注

    Since it is a new window you first need to reach the opener which is window.opener. Give your iframe an id, and you can reach it by using: document.getElementById. Putting it together, it would be something like this:

     window.opener.document.getElementById('youriframe').location.reload( true );
    

    You might also call a method in the opener context:

    // in window opener:
    function refreshFrame() {
      document.getElementById('IdOfYourFrame').location.reload(true);
    }
    
    // in new window (window open) you call the method by:
    window.opener.refreshFrame();
    

    I put together a Codepen Expamle to demonstrate. Be aware that this is only working in case the different window locations are from the same domain (window.opener cross-domain security).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教