본문으로 바로가기

팝업창 열려있는지 확인

category Frontend/Javascript 2020. 1. 3. 14:19
반응형

팝업창 열려있는지 확인


var windowObjHistorySearch = null;
 
function btnHistorySearchView() {
         
    // 팝업창 열려 있는지 확인
    if(windowObjHistorySearch == null) {
        windowObjHistorySearch = window.open(URL타이틀, 옵션);
    } else {
        if(windowObjHistorySearch.closed) {
            windowObjHistorySearch = window.open(URL타이틀, 옵션);
        }
    }
 
    // 현재 팝업창 
    windowObjHistorySearch.focus();
}  
</script>
 
<a href="#" onclick="btnHistorySearchView();"></a>




반응형