js

새창으로 열기 창이 열려있을경우 Window 재사용하기

프로그래애머 2019. 7. 4. 14:18

 // 파라미터 하나만 넘길경우

function getDetail(param){ 
   var siteWin=window.open(contextPath+"/pageName.do?param1="+param , "윈도우 이름", "");    
   var siteUrl = contextPath+"/pageName.do";

   if (!siteWin || siteWin.closed ) {
       siteWin=window.open(siteUrl+"?param1="+param, "윈도우 이름");
   } else{
       siteWin.location=siteUrl+"?param1="+param; 
       siteWin.focus();
   }
}