First of all this is not a question about how can I use http client on server, it's more about JS.
I have a protected area on site (let say /myprotected/ ), all css and images are on it. I want to html post it all (let say /htmlconverter) . And on server side finally convert it to looks like offline page. Something like "save as" in browser. Here is the code for html text only
function submitForm(){
var htmlelement = document.getElementById("html");
htmlelement.value = document.getElementById("source").innerHTML;
document.forms["innerForm"].submit();
}.....
<form id="innerForm" method="post" action="/htmlconverter">
<input type="text" id="html" name="html" style="display:none"/>
<input type="button" value="submit" onclick="submitForm()"/>
</form>
Is there a way to send all resources including img and css to server?
Added: I find this topic on serializing images Get image data in JavaScript?
For css I will try to AJAX call the css source and add response as a text to a new post.