JavaScript window.open: Display Modal Popup Window - ASPSnippets Toggle navigation. In the PopUp Page I have written a small script that runs when the PopUp page is closed. When the user clicks on (x), close the modal and When the user clicks anywhere outside of the modal, close it.The above javascript show the the modal once when website load. I've just centered the modal vertically in the browser window and the footer buttons horizontally for a better visual user experience. You could use sessionStorage - code example below: , if (sessionStorage.getItem('modal') !== 'true') {, $('body').append('