Reputation: 1314
I want to create a link element with the html download attribute from my GWT Presenter. Using an UI-Binder is not an option. I tried using an Anchor object but could not find an option there. Is it possible without using JavaScript?
Upvotes: 0
Views: 558
Reputation: 236
Anchor a = new Anchor("download something", "download.html");
a.getElement().setAttribute("download", "");
This will create a link with an empty download attribute.
If you set a value for the attribute, this value will be used as the pre-filled filename in the Save prompt, for example:
a.getElement().setAttribute("download", "downloadname.html")
Upvotes: 3