如何使用javascript在客户端创建HTML文件? [英] How can I create a HTML file on the client's side using javascript?
本文介绍了如何使用javascript在客户端创建HTML文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们,您好!
如何使用javascript在客户端创建HTML文件?
document.documentElement.innerHTML的值表示客户端网页的全部内容,那么如何通过JS将document.documentElement.innerHTML值保存为HTML文件?
提前谢谢。
Hello, friends!
How can I create a HTML file on the client's side using javascript?
There is a value of document.documentElement.innerHTML that represents the whole content of the webpage on the client's side, so how can I save the document.documentElement.innerHTML value as a HTML file via JS?
Thank you in advance.
推荐答案
不确定这是不是你想要的但是试试这个:
< a href =https://github.com/eligrey/FileSaver.js> https://github.com/eligrey/FileSaver.js [ ^ ]
这是一个演示:
http://eligrey.com/demos/FileSaver.js/ [ ^ ]
not sure if that's what you want but try this :
https://github.com/eligrey/FileSaver.js[^]
here's a demo :
http://eligrey.com/demos/FileSaver.js/[^]
您无法在客户端文件系统上创建文件,这将是一个巨大的安全风险。
You can't create files on the client file system, it would be a massive security risk.
这篇关于如何使用javascript在客户端创建HTML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文