canvas.toBlob(function(blob) {
// blob ready, download it
let link = document.createElement('a');
link.download = 'example';
link.href = URL.createObjectURL(blob);
link.click();
// delete the internal blob reference, to let the browser clear memory from it
URL.revokeObjectURL(link.href);
}, 'image/jpg');
<a download="hello.txt" href='#' id="link">Download</a>
<script>
let blob = new Blob(["Hello, world!"], {type: 'text/plain'});
link.href = URL.createObjectURL(blob);
</script>
hljs.highlightAll()
函数let dom = document.querySelector('textarea')
dom.onkeydown = function(e){
console.log(e.key)
console.log(e.code)
console.log(e.keyCode)
if(e.keyCode == 13){
e.returnValue = false
console.log('禁用enter事件')
}
}
<iframe id="pdf" name="pdf"
src="static/web/viewer.html?file=compressed.tracemonkey-pldi-09.pdf"
style="width:100%; height:500px">
</iframe>