compilar html con javascript y volcarlo al archivo

I have html with javascript code that modifies the html and prints data, and I want to dump this page to a file.

<html>
<head>
<script type="text/javascript">
document.write("<h1>This is a heading one </h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
</head>
<body>
<h1>This is a heading two </h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>

salida.html

<html>
<head>
<script type="text/javascript">
document.write("<h1>This is a heading one </h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
</head>
<body>
<h1>This is a heading one </h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<h1>This is a heading two </h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>

I think I need something like html+ java script engine .. browser with command line interface so I can call a page and then dump its output to file .. any ideas??... any help will be appreciated, thanks

preguntado el 10 de marzo de 12 a las 12:03

Can you elaborate on what you need this for? -

You cant - you cannot access the clients filesystem using JavaScript, why are you trying to do this ? -

I would do it on server side with PHP for instance. Would it be possible to use PHP on the server in your case? -

i need to for pdfjs system (online javascipt reader using javascript) .. this system will convert pdf using javascript at client sude ,, and i need to do all this process at server side so client only get final html page -

1 Respuestas

If you just want to do it a few times manually you can use IE 9 Dev tools. in IE 9, you can do F12, then Ctrl+S to save the file to the desired location.

respondido 10 mar '12, 12:03

... or Opera or Chrome or Firefox or Safari ... well, any browser with dev tools. IE9 would actually have been my last suggestion. You forgot to mention that - in IE only - he would need to update the view of the dev tools after pressing F12 by using the little reload icon (not the one for the website) - Jörn Berkefeld

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.