同名窗口不能重新打开

var globalWin;//全局变量,表示打开的那个窗口对象

globalsubmitForm.LaunchWindow = function (sHref, winName, width, height, top, left) {
var windowSettings = 'status=yes,menubar=no,scrollbars=yes,toolbar=no,resizable=yes,';
if (width == 0 && height == 0) {
windowSettings += 'width=' + (screen.width - 12);
windowSettings += ', height=' + (screen.height - 100);
windowSettings += ', top=0, left=0';
}
else {
windowSettings += 'width=' + width;
windowSettings += ', height=' + height;
windowSettings += ', top=' + top;
windowSettings += ', left=' + left;
}
if (globalWin == null || globalWin.closed) {
globalWin = window.open(sHref, winName, windowSettings);
globalWin.focus();
}
else {
alert('同名窗口已经打开,请先关闭打开的窗口');
}
}

原文地址:https://www.cnblogs.com/LGDD/p/7746396.html