SciterSharp.SciterWindow.LoadHtml C# (CSharp) Method

LoadHtml() public method

Loads HTML input from a string
public LoadHtml ( string html, string baseUrl = null ) : bool
html string HTML of the page to be loaded
baseUrl string Base Url given to the loaded page
return bool
		public bool LoadHtml(string html, string baseUrl = null)
		{
			var bytes = Encoding.UTF8.GetBytes(html);
			return _api.SciterLoadHtml(_hwnd, bytes, (uint)bytes.Length, baseUrl);
		}

Usage Example

Example #1
0
        public void TestODH()
        {
            TestableDOH odh = new TestableDOH();

            SciterWindow wnd = new SciterWindow();
            wnd.CreateMainWindow(1500, 800);
            wnd.Title = "Wtf";
            bool res = wnd.LoadHtml(@"
            <html>
            <style>
            body { wtf: 123; }
            </style>

            <script type='text/tiscript'>
            </script>
            </html>
            ");
            Assert.IsTrue(res);

            PInvokeWindows.MSG msg;
            while(PInvokeWindows.GetMessage(out msg, IntPtr.Zero, 0, 0) != 0)
            {
                wnd.Show();
                PInvokeWindows.TranslateMessage(ref msg);
                PInvokeWindows.DispatchMessage(ref msg);
            }

            Assert.IsTrue(odh.msgs.Count == 1);
        }