0
我想創建一個鏈接元素,其中包含來自我的GWT Presenter的html download attribute。使用UI-Binder不是一種選擇。我嘗試使用Anchor對象,但在那裏找不到選項。有沒有可能不使用JavaScript?創建具有下載屬性的GWT錨元素
我想創建一個鏈接元素,其中包含來自我的GWT Presenter的html download attribute。使用UI-Binder不是一種選擇。我嘗試使用Anchor對象,但在那裏找不到選項。有沒有可能不使用JavaScript?創建具有下載屬性的GWT錨元素
Anchor a = new Anchor("download something", "download.html");
a.getElement().setAttribute("download", "");
這將創建一個帶有空白下載屬性的鏈接。
如果設置該屬性的值,該值將被用作保存提示的預填充文件名,例如:
a.getElement().setAttribute("download", "downloadname.html")
屬性總是有一個值。當瀏覽器解析時,'download'相當於'download =「」''。 –
感謝@Thomas Broyer的信息。我更新了我的答案。 –