Please check the below code
<div
data-testid="certification-div"
style={certificationStyle}
onClick={() => {
const width = 600;
const height = 600;
const left = window.screen.width / 2 - width / 2;
const top = window.screen.height / 2 - height / 2;
const popup = window.open(
completionURL,
"_blank",
`width=${width},height=${height},left=${left},top=${top},noopener,noreferrer`
);
if (popup) {
popup.focus();
}
}}
>
I have a div that opens a popup window that with the completion URL that url redirects to a aspx page which downloads automatically downloads the PDF file. Since the download logic is written in that aspx page I have to open that url in a popup window I cant directly call an API to get that file .Once that PDF file is downloaded I need to automatically close this popup window. The issue here is I cant change any thing at the backend page (aspx), all the changes that needs to be handled are at the front end (react side). Is it possible to handle such scenario.?