Is there a way to load a html as a string in webControl?
Something like:
webControl.Load("<!DOCTYPE html><html>...");
Like used in the normal wpf webControl:
webControl.NavigateToString("<!DOCTYPE html><html>...");
Is there a way to load a html as a string in webControl?
Something like:
webControl.Load("<!DOCTYPE html><html>...");
Like used in the normal wpf webControl:
webControl.NavigateToString("<!DOCTYPE html><html>...");
Actually now I found the answer in the tutorials for C++ (not on .net wpf) in Awesomium site.
Here is my solution:
var uri = new Uri("data:text/html,<!DOCTYPE html><html>...", UriKind.Absolute);
webControl.Source = uri;
Here is my solution: Load html string to a file and then load page using webControl.Source property.
public static string WriteHtmlToTempFile(string html)
{
var fileName = GetTempFileName("html");
System.IO.File.WriteAllText(fileName, html);
return fileName;
}
var strHtml = "<HTML> Hello World</HTML>";
var file = Common.WriteHtmlToTempFile(strHtml);
var wUri = new Uri(string.Format(@"file://{0}", file ));
webControl2.Source = wUri;