a(HTML)
anchor
noreferrer
noopener
阻止連結後的網站使用window.opener
nofollow
$ rel="noreferrer noopener nofollow"
不開啟分頁直接下載內容
code:javascript
const download = (jsondata) => {
const data = JSON.stringify(jsondata)
const filename = 'download.json'
const type = 'application/json'
const file = new Blob(data, { type }); const url = URL.createObjectURL(file);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
setTimeout(() => {
URL.revokeObjectURL(url);
}, 0);
}