问题
I need to save web page using Qt WebKit similar to "Save as complete webpage".
Following are my requirements,
- Save the index html file, maintaining entity encoding.
- Need to download all linked images and other resources.
- Need to change resource path in html page to local downloaded path.
- Need to maintain webpage current state.
I can use Qt and JavaScript to do this.
Please provide me some inputs on this.
Thanks
回答1:
You could use a HTML parser to parse the current page, then look for all the images (xpath "//img"), download their files, and change their src attributes.
回答2:
how about save the html to local system and call setHtml() when you need it?
来源:https://stackoverflow.com/questions/2963535/how-to-save-webpage-in-qt-webkit-as-save-as-complete-webpage