-1

I was wondering if it was possible to create a new HTML page using javascript and then saving it to its own document so it can be accessed through another link (ex. make a document and save it as test.html and then localhost/test.html leads to that document). I have looked online and have unsuccessfully found what I was looking for, unless I'm just misunderstanding the code. Anyone care to explain how to do this? Thanks in advance!

Theo
  • 37
  • 6
  • See [Edit, save, self-modifying HTML document; format generated HTML, JavaScript](http://stackoverflow.com/questions/30563157/edit-save-self-modifying-html-document-format-generated-html-javascript) – guest271314 Aug 31 '16 at 04:15

1 Answers1

-1

Use Node fs.writeFile https://nodejs.org/api/fs.html

fs.writeFile('message.txt', 'Hello Node.js', (err) => {
  if (err) throw err;
  console.log('It\'s saved!');
});

Or with PHP escapeshellcmd('touch file.html')

Vinnie James
  • 5,763
  • 6
  • 43
  • 52