6

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

Thanks

Liam McInroy
  • 4,264
  • 5
  • 31
  • 52
intl
  • 2,613
  • 9
  • 40
  • 66
  • this type of question has been asked many times before: http://stackoverflow.com/questions/582268/jquery-read-write-to-file/582281 – Naeem Sarfraz Sep 30 '10 at 05:16

3 Answers3

1

(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).

Ruel
  • 14,929
  • 7
  • 36
  • 49
0

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.

Perpetualcoder
  • 13,331
  • 8
  • 60
  • 98
-1

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.

Dan M
  • 1,725
  • 1
  • 11
  • 17