2016-09-23 47 views

回答

2
Anchor a = new Anchor("download something", "download.html"); 
a.getElement().setAttribute("download", ""); 

這將創建一個帶有空白下載屬性的鏈接。

如果設置該屬性的值,該值將被用作保存提示的預填充文件名,例如:

a.getElement().setAttribute("download", "downloadname.html") 
+1

屬性總是有一個值。當瀏覽器解析時,'download'相當於'download =「」''。 –

+0

感謝@Thomas Broyer的信息。我更新了我的答案。 –

相關問題