How to save webpage in Qt WebKit as “save as complete webpage”

心已入冬 提交于 2019-12-10 15:17:37

问题


I need to save web page using Qt WebKit similar to "Save as complete webpage".

Following are my requirements,

  1. Save the index html file, maintaining entity encoding.
  2. Need to download all linked images and other resources.
  3. Need to change resource path in html page to local downloaded path.
  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!