Waiting for child window loading to complete

前端 未结 3 2174
盖世英雄少女心
盖世英雄少女心 2020-11-30 04:10

Is there an easy hook for detecting that a window opened by a script has finished loading? Basically, I want the equivalent of the onLoad() hook, but I can\'t s

3条回答
  •  情歌与酒
    2020-11-30 04:56

    This works if the location of the newly opened window is same-origin:

    var w = window.open('child.html')
    w.addEventListener('load', w.doSomething, true); 
    

提交回复
热议问题