简体   繁体   English

Javascript生成文件并要求用户保存它,可能吗?

[英]Javascript generate file and ask user to save it, possible?

I'm trying to create a simple function that will generate a file from Javascript and then ask the user to save it on their computer somewhere. 我正在尝试创建一个简单的函数,它将从Javascript生成一个文件,然后要求用户将它保存在他们的计算机上。

First off is that possible using just JavaScript? 首先,只使用JavaScript可能吗?

Second if so do you have a tutorial page that explains how 第二,如果有,你有一个解释如何的教程页面

Second if not, do you know of the best way to go around this? 如果不是,你知道最好的解决方法吗?

Javascript: Create and save file The file known as FileSaver.js works fine :) Javascript:创建并保存文件称为FileSaver.js的文件工作正常:)

Cheers Robert Harvey 干杯罗伯特哈维

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM