gpt4 book ai didi

保存txt文件的javascript代码

转载 作者:搜寻专家 更新时间:2023-10-31 22:50:20 26 4
gpt4 key购买 nike

谁能告诉我如何使用与浏览器兼容的 javascript 创建 .txt 文件。

创建文件后,它会显示另存为对话框,以便我可以保存创建的文件。

任何其他逻辑也欢迎

我在 IE 中做得很好,

但是相同的代码没有在其他浏览器中运行

最佳答案

You can't do this, for hopefully obvious security reasons. JavaScript has no access to the file system...in IE it's not JavaScript, but ActiveX doing this...it just has a JavaScript API exposed.

The problem isn't that Firefox doesn't do this...it's that IE ever allowed it :)

在这篇文章中 In Firefox, Write to a File using Javascript?

关于保存txt文件的javascript代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6854296/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com