I’m working on WOPI app. I created WOPI host page and execute this endpoint:
/wv/WordViewer/request.pdf?WOPISrc={WopiUrl}&type=downloadpdf
that download file (convert .docx to .pdf and download).
After successful downloading I want to close browser tab.
I just hardcoded this way:
var o = document.getElementsByTagName('iframe')[0];
var iframeDoc = o.contentWindow.document;
checkIframeLoaded();
function checkIframeLoaded() {
console.log(iframeDoc.readyState);
if (iframeDoc.readyState == 'complete') {
window.close();
} else {
setTimeout(checkIframeLoaded, 1000);
}
}
But it isn’t what I want, it closes the tab after DOMContentLoaded success but .pdf document wasn’t downloaded
Maybe there is a way to catch all requests are completed or something else? I just need to check somehow that /wv/WordViewer/request.pdf?WOPISrc={WopiUrl}&type=downloadpdf
successfully completed.
6