我想调用下面的函数来创建一个弹出的新窗口。无论何时,我都在调用它在chrome中崩溃父窗口。试图在window.open后从父窗口调用子窗口函数
我观察到:直到openDoctorDetails函数被执行,子窗口根本没有加载。因为doctorDetailsPage.populateDoctorDetails
从未被定义。因此,它将陷入无限循环。
var openDoctorDetails = function(physicianId) {
var time1 = new Date();
var doctorDetailsPage = window.open('PhysicianDetails.html', '_blank',
'resizable=yes; width=1000; height=1500; top=50; left=50');
var times = 0;
while (!doctorDetailsPage.populateDoctorDetails) {
setTimeout(function() {
times++;
}, 500);
}
doctorDetailsPage.populateDoctorDetails(physicianId);
doctorDetailsPage.focus();
console.log("Time taken for this openDoctorDetails:" + (new Date() - time1)
+ " " + times);
};
http://stackoverflow.com/questions/13311812/popup-window-accessing-parent-dom – Mikes3ds