From a9d9b9f33de9796e27e748e38e11162ba6ad7f8b Mon Sep 17 00:00:00 2001 From: jikwan0327 <102665117+jikwan0327@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:16:34 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EB=8B=AB=ED=9E=98=20?= =?UTF-8?q?=EC=8B=A4=ED=97=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/popup.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/apis/popup.tsx b/src/apis/popup.tsx index e885d00..d65b35f 100644 --- a/src/apis/popup.tsx +++ b/src/apis/popup.tsx @@ -24,11 +24,24 @@ export const useOpenPopUp = () => { setToken(mdl_tknValue); - window.open( + const width = 500; + const height = 400; + const left = window.screenX + (window.outerWidth - width) / 2; + const top = window.screenY + (window.outerHeight - height) / 2; + var popup = window.open( `/pass?mdl_tkn=${mdl_tknValue}`, '_blank', - 'resizable=no,width=570,height=830,left=50,top=50', + `resizable=no,width=${width},height=${height},left=${left},top=${top}`, ); + + // popup!.onbeforeunload = function () { + // alert('팝업이 닫혔습니다'); + // }; + + window.addEventListener('beforeunload', (e) => { + console.log(e); + alert('닫힘'); + }); }, }, );