I want to show a html document in a web browser control (WinForms). The html file should contain images, that are embedded resources.
How can I modify the html that is s开发者_如何学运维hown in the webbrowser to replace the src attribute of the img tags to somehow show the embedded resource without copying it into the file system?
You could use src="data:image/png;base64,....
and replace the ....
with the base64 encoded string.
You'll need to replace the src="url"
for the img tags in the given HTML, which means you would have to store the HTML somewhere on disk temporarily, so I guess doesn't solve the problem, unless you have access to the HTML.
As you know Data URI's have problem with older browsers (IE < 8) so :
You can use MHTML manner to save your embedding images.
You can make Data URI's with this kind of javascript.
精彩评论