I am building a web application (PWA) using Javascript. I want the application to automatically open downloaded files, such as PDF, DOCX, etc., in an external standard application such as Adobe Reader and Word. Is there a function in Javascript that solves my problem? At the moment, the application simply downloads the file to the device.
Unfortunately, I do not have much experience with Javascript, so I apologize if this is a stupid question.
XHR.responseType = 'blob';
XHR.onload = function() {
var data = this.response;
var a = document.createElement('a');
a.href = window.URL.createObjectURL(data);
a.download = fileName;
a.dispatchEvent(new MouseEvent('click'));
};