let element = document.createElement('a') element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)) element.setAttribute('download', filename) // element.style.display = 'none' // element.click()
element.click()火狐瀏覽器不支持瀏覽器