I\'m using fancy box to create a popup and load another page on it using an iframe. here is my code
Use event close button of fancybox:
document.getElementsByClassName("fancybox-item fancybox-close")[0].click();