OK, so this what I'm trying to do - and I'm open to suggestions.
save as
, no nothing) save the source locally How can this be done?
PS I've been playing with the .js console, firebug, etc. But I'm still not sure how to go about this. So any suggestion is more than welcome! :-)
You can use this snippet to save the HTML source on HD using JS, here document.documentElement.outerHTML
is used to get the HTML source for the page:-
<HTML>
<HEAD>
<script LANGUAGE="JavaScript">
function SaveToDisk(sPath)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fileDest = fso.CreateTextFile(sPath, true);
if (fileDest)
{
fileDest.Write(document.documentElement.outerHTML);
fileDest.close();
}
else
{
alert("unable to create file " + sPath);
}
}
</script>
</HEAD>
<BODY onload="SaveToDisk('c:\\temp\\123.htm');">
<P>The rest of the page is here...</P>
</BODY>
</HTML>
There is also a solution available where you can save source for another website by providing the url , check this
For chrome, open the js console and enter:
window.open('data:text/html;charset=utf-8,' + escape(document.documentElement.outerHTML));
Then you can save the generated html. It may also work in other browsers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.