How to configure file upload in a single page application without rebooting?
I had a situation where a PDF file is generated on the server and must be provided to the client for download. Sending it as an application / octet stream does not help anything in SPA, because files cannot be sent via AJAX .
The best I came up with is to save the generated file in a temporary folder on the server by sending the URL to the client and doing window.open(url) . The problem is that different browsers open files differently. Firefox, for example, opens PDF files in one tab by default, using their PDF.js , violating the whole idea of SPA. But executing window.open(url, '_blank') often causes pop-up blockers, etc. Other types of files may cause God to know that ...
Is there a cross-browser, secure, general method for uploading files to the SPA?
javascript single-page-application
Sljux
source share