CSV Download from Data Frame fails if hosted in Cross Origin iFrame on Chrome and Edge


Note: I have not shared source code as the issue is with running the Streamlit app in an iFrame from another (sub)domain

On Chrome and Edge the CSV download option uses showSaveFilePicker() in the download process, however, this is blocked if the app is running in a cross-origin iFrame.

Error message shown in Chrome or Edge Browser Console
Uncaught (in promise) DOMException: Failed to execute ‘showSaveFilePicker’ on ‘Window’: Cross origin sub frames aren’t allowed to show a file picker.

CSV download from cross origin iFrame works in Firefox and other browsers which don’t support the experimental File System Access API. Files are simply downloaded to the Downloads folder without showing a File dialog. It would be great if this could be the case for Chrome and Edge as well, at least if running in a Cross Origin iFrame

1 Like