Set a callback function to a new window in javascript

后端 未结 2 1142
广开言路
广开言路 2020-11-27 05:38

Is there an easy way to set a \"callback\" function to a new window that is opened in javascript? I\'d like to run a function of the parent from the new window, but I want t

2条回答
  •  北海茫月
    2020-11-27 06:28

    var newWindow = window.open(window.location.origin);
    
    newWindow.onload = function() {
        $(newWindow.document.body).addClass('new-window-body-class');
    };
    

提交回复
热议问题