/** * @param { string } url * @param { string } windowName * @param { number } width * @param { number } height */ export function openWindow(url, windowName, width, height) { var x = parseInt(screen.width / 2.0) - width / 2.0; var y = parseInt(screen.height / 2.0) - height / 2.0; var isMSIE = navigator.appName == "Microsoft Internet Explorer"; if (isMSIE) { var p = "resizable=1,location=no,scrollbars=no,width="; p = p + width; p = p + ",height="; p = p + height; p = p + ",left="; p = p + x; p = p + ",top="; p = p + y; window.open(url, windowName, p); } else { var win = window.open( url, "ZyiisPopup", "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,modal=yes,width=" + width + ",height=" + height + ",resizable=no" ); eval("try { win.resizeTo(width, height); } catch(e) { }"); win.focus(); } }
转载地址:https://juejin.im/post/5edb6c6be51d4578a2555a9b#heading-107