網(wǎng)站開發(fā)投標(biāo)書范本目錄阿里云域名注冊(cè)查詢
Crow:設(shè)置網(wǎng)站的index.html-CSDN博客
講述了如何完成一個(gè)最簡(jiǎn)單的網(wǎng)頁(yè)的路由
很多網(wǎng)頁(yè)提供了下載功能,怎么實(shí)現(xiàn)呢,其實(shí)也很簡(jiǎn)單。
假設(shè)網(wǎng)頁(yè)的目錄結(jié)構(gòu)如圖
$ tree static
static
├── img
│ └── goodday.jpg
└── index.html
//index.html
<html>
<body><h1>Hello world</h1>
<img src="/static/img/goodday.jpg" alt="good day" style="width: 500px;" onclick="downloadimg('goodday1.jpg')"><script>function downloadFile (data, fileName){var blob = new Blob([data]);var downloadElement = document.createElement('a');var href = window.URL.createObjectURL(blob);downloadElement.href = href;