HTML <area> download 屬性
示例
當用戶點選超連結時,使用 download 屬性指定目標將被下載
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="太陽" href="info_about_the_sun.htm" download="sun">
<area shape="circle" coords="90,58,3" alt="水星" href="merglobe.gif" download="mercury">
<area shape="circle" coords="124,58,8" alt="金星" href="information_about_the_planet_venus.txt" download="venus">
</map>
自己動手試一試 »
更多“自己嘗試”的例子見下文。
定義和用法
download
屬性指定當使用者點選超連結時,目標(href
屬性中指定的 檔案)將被下載。
download
屬性的可選值將是下載後的新檔名。允許的值沒有限制,瀏覽器會自動檢測正確的副檔名並新增到檔名中(.img, .pdf, .txt, .html 等)。
如果省略該值,則使用原始檔名。
瀏覽器支援
表格中的數字表示完全支援該屬性的第一個瀏覽器版本。
Attribute | |||||
---|---|---|---|---|---|
download | 14.0* | 18.0 | 20.0* | 10.1 | 15.0 |
* Chrome 65+ 和 Firefox 只支援同源下載連結。
語法
<area download="檔名">
屬性值
值 | 描述 |
---|---|
filename | 可選。指定下載檔案的檔名 |
更多示例
示例
為 download 屬性指定一個值,該值將是下載檔案的檔名(例如 sun.htm 而不是 information_about_the_sun.htm)
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="太陽" href="info_about_the_sun.htm" download="sun">
<area shape="circle" coords="90,58,3" alt="水星" href="merglobe.gif" download="mercury">
<area shape="circle" coords="124,58,8" alt="金星" href="information_about_the_planet_venus.txt" download="venus">
</map>
自己動手試一試 »
❮ HTML <area> 標籤