Any means to download the file?
See original GitHub issueI’d like to create a button which, when clicked, causes a file to be downloaded in the browser. To my understanding, in regular HTML this is handled by href
attribute.
I tried: ui.button('Download configuration file').classes('my-2 mx-4').props('href=https://quasar.dev')
which, according to https://quasar.dev/vue-components/button#example--links, I thought, should cause the browser to issue GET request to go to quasar.dev
website. But there’s no reaction after click.
Or should it be handled with ui.add_route
for serving the file and on_click=lambda: ui.open(route_url)
button argument?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Download a file - Android - Google Chrome Help
Go to the web page where you want to download a file. Touch and hold what you want to download, then tap Download...
Read more >What is downloading? - TechTarget
Downloading is the transmission of a file or data from one computer to another over a network, usually from a larger server to...
Read more >Download files from the web - Microsoft Support
Learn how to download files from the web, change your default download location, and find files you've downloaded on your PC using Internet...
Read more >Basic Computer Skills: Downloading and Uploading
Downloading means receiving data or a file from the Internet on your computer. Uploading means sending data or a file from your computer...
Read more >Download items from the web using Safari on Mac
In Safari on your Mac, download music, a PDF, software, and other items. Also see what you downloaded previously.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, the
href
attribute points to the location where the resource can be accessed. The server, however, needs to provide the file at this location. Since NiceGUI implements frontend and backend, you need to take care of both.Using
ui.get
is totally fine. You could even leave out therequest
argument. Since version 0.7.28 you can also useui.add_static_files('/some/route', 'path/to/some/folder')
. Then you can access every file in this folder via e.g. `/some/route/file.json’.Wrapping a button inside a link seems a little weird. Combining a button with
ui.open
should work:Note that without providing the socket, every browser connected to the app would open the file, not only the one that triggered the click event.
So it’s not only me? I thought my Firefox extensions could play tricks on me. Oh well.