让用户无需任何 HTML 即可下载动态生成的 Blob
let link = document.createElement('a');
link.download = 'hello.txt';
let blob = new Blob(['Hello, world!'], {type: 'text/plain'});
link.href = URL.createObjectURL(blob);
link.click();
URL.revokeObjectURL(link.href);
let link = document.createElement('a');
link.download = 'hello.txt';
let blob = new Blob(['Hello, world!'], {type: 'text/plain'});
link.href = URL.createObjectURL(blob);
link.click();
URL.revokeObjectURL(link.href);
更新:2023年3月17日
要在 Chrome 浏览器中打开 "Show user agent shadow DOM" 选项,请按照以下步骤操作:
## 作废
在 Chrome 浏览器中打开“Show user agent shadow DOM”选项,请按照以下步骤操作:
完成上述步骤后,您应该能够在 Chrome 浏览器的开发者工具中查看用户代理的 Shadow DOM。