HTML <area> download 屬性
實例
一個帶有可點擊下載區域的圖片:
<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun" href="information_about_the_sun.htm" download="sun">
<area shape="circle" coords="90,58,3" alt="Mercury" href="merglobe.gif" download="mercury">
<area shape="circle" coords="124,58,8" alt="Venus" href="information_about_the_planet_venus.txt" download="venus">
</map>
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun" href="information_about_the_sun.htm" download="sun">
<area shape="circle" coords="90,58,3" alt="Mercury" href="merglobe.gif" download="mercury">
<area shape="circle" coords="124,58,8" alt="Venus" href="information_about_the_planet_venus.txt" download="venus">
</map>
流覽器支持
目前只有Firefox 和 Chrome支持download 屬性。
定義和用法
download 屬性指定了下載鏈接地址。
只有在使用了href屬性才需要指定download屬性。
該屬性屬性同樣可以指定下載檔的名稱。檔案名稱沒有限定值,流覽器會自動在檔案名稱末尾添加該下載檔的尾碼 (.img, .pdf, .txt, .html, 等)。
HTML 4.01 與 HTML5之間的差異
The download attribute is new for the <area> tag in HTML5.
語法
<area
download="filename">
屬性值
值 | 描述 |
---|---|
filename | 指定檔案名稱。 |