When generating a CSV file with Javascript, and trying to make the file available for download locally, using the snippet below:
const blobToBase64 = (blob) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
return new Promise((resolve) => {
reader.onloadend = () => {
resolve(reader.result);
};
});
};
The page works fine in Classic. But in Lightning Experience I get this annoying popup saying that because of browser settings it needs permission to access the URL. When I click "open" anyway, nothing happens (expected file download, like in Classic, instead).
The URL is different from the one I see on the browser:
Section | URL |
---|---|
Browser search bar | https://company--sandboxname.sandbox.lightning.force.com/lightning/n/DynamicExportUtilityPage |
Popup warning | https://company--sandboxname--c.sandbox.vf.force.com |
I've added the popup warning URL to CSP and CORS, but nothing happens. The browser allows popups from the address too.
Would it be possible to make this work?