I am trying to invoke the below function to create a new window pop up. Whenver, I am invoking that it is crashing the parent window in chrome.
What I have observed: Till the openDoctorDetails function is executed, the child window is not loaded at all. Because of that doctorDetailsPage.populateDoctorDetails
is never defined. Thence, it is going into an infinite loop.
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);
};