Loading arbitrary HTML

How to load an arbitrary string of HTML

Set your base directory

You will first need to set your base directory in the WebCore-- the base directory is used to resolve any relative URLs in your HTML. You can set this path by calling WebCore::setBaseDirectory:

C++ API

myWebCore->setBaseDirectory("C:\\MyApplication\\MyBaseDirectory");

C# API

WebCore.SetBaseDirectory("C:\\MyApplication\\MyBaseDirectory");

Call WebView::loadHTML

To load arbitrary HTML into a WebView, call WebView::loadHTML with your string of HTML, here's an example:

C++ API

myWebView->loadHTML("<p>Hello World!</p>");

C# API

myWebView.LoadHTML("<p>Hello World!</p>");

Asynchronous behavior

Be aware that is an asynchronous operation, which basically means that the WebView will only begin loading your HTML when the function returns-- the page is not likely to be fully loaded until sometime later.

If you would like to receive notification when the page finishes loading, please see WebViewListener::onFinishLoading (or WebView.OnFinishLoading in C#).