dash-core-components icon indicating copy to clipboard operation
dash-core-components copied to clipboard

dcc.Download doesn't open a file picker dialog on Safari

Open kamatsuoka opened this issue 1 year ago • 0 comments

MacOS Sonoma 14.2.1 Safari 17.2.1

dcc.Download doesn't open a file picker dialog on Safari. Instead, it just downloads the file to the ~/Downloads directory using the supplied filename. Example that works as expected on Chrome:

from dash import Dash, Input, Output, callback, dcc, html

app = Dash(__name__)
app.layout = html.Div(
    [
        html.Button("Download Text", id="btn-download-txt"),
        dcc.Download(id="download-text"),
    ]
)


@callback(
    Output("download-text", "data"),
    Input("btn-download-txt", "n_clicks"),
    prevent_initial_call=True,
)
def func(n_clicks):
    return dict(content="Hello world!", filename="hello.txt")


if __name__ == "__main__":
    app.run(debug=True)

kamatsuoka avatar Mar 13 '24 23:03 kamatsuoka