Because I need to save a web page as a mht file format for a report function. But, my page is build by a Javascript framework(dojo) and the html source just like this.
<div id="main">
<div width="99%">
<table id="contents">
<tr>
<td id="con_right"></td>
</tr>
</table>
</div>
</div>
At the same time, I also have a controller to set report html to these DOM object dynamically. But I can not save this page as a mht file. Because “Save as” just base on static HTML.
So, I need help for transform a dynamic DOM object in Javascript to a static HTML page.
PS.
I can include any other Javascript framework. If there is a good and fast solution for transform.
Here is an example of how to print out the source for any DOM node – you should be able to use that to print the entire page HTML.
EDIT: You might even be able to do something easier:
EDIT2:
Since you want the generated html to be a static html page, pretty much the only way you’re going to (somewhat) reliably get that is to do it via the server. Send your htmlified DOM to the back end, and have the callback to a redirect to a newly-generated static page with that html.
The implementation is between you and your back-end software, but it can have the following sort of form:
Front-end:
Back-end: