My program is appending some HTML elements from a template HTML file by user's actions.
string currDir = Directory.GetCurrentDirectory();
string targetURL = String.Format("file:///{0}/Resources/question_template.html", currDir);
web.Navigate(targetURL);
web.DocumentCompleted += Web_DocumentCompleted;
// writing user's selections into a html file as table.
private static void Web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
GenerateQuizForTypeA(MainWindow.VM.lstPartA_Words);
...
File.WriteAllText(@"Resources\bob_output.html", web.Document.Body.Parent.OuterHtml, Encoding.GetEncoding(web.Document.Encoding));
}
And the weird point is the HTML files are generated totally differently depending on the environments. What I've understood so far is that C# WinForms webbrowser is based on IE7 rendering engine unless you change the registry value. (like this : Use latest version of Internet Explorer in the webbrowser control)
but This is not about rendering problem. I didn't expect two different HTML files could be created via same exe file. I used webbrowser's HtmlElement, web.Document.CreateElement, SetAttribute
Please refer to both screenshots. both programs were built in envB and using .net Framework 3.5, WPF(but currently using WinForms webbrowser with WindowFormsIntegration)
(envA) Windows7 64bit, IE8
Additionally, all elements are turned into upper cases plus it gets rid of double quotations. link: http://softinus.com/files/bob/bob_output_IE8.html
(envB) Windows10 64bit, IE11
link : http://softinus.com/files/bob/bob_output_IE11.html