开发者

Create HTML file with JavaScript

开发者 https://www.devze.com 2023-01-18 17:04 出处:网络
I\'m looking for a way to use a JavaScript function 开发者_Go百科to create a new HTML file in the local directory. Is this possible?

I'm looking for a way to use a JavaScript function 开发者_Go百科to create a new HTML file in the local directory. Is this possible?

Thanks


(Client Side) Yes, but you might need to create a new ActiveX Object, therefore the browser should be IE only.

(Server Side) Just use any server-side scripting language (JS is not one).


Just for web sanity and security. Making JS do things like that is obtrusive. You might write a text file someone else might write virus.py on the client side.


Using javascript to create html is generally a bad idea because that's not what javascript was designed for, and there is nothing about javascript that makes it well-suited for that task. You're much better off generating html with a server-side language like php, which is commonly used to create html.

0

精彩评论

暂无评论...
验证码 换一张
取 消