Loading It Up

There are two flavors of loadData(). The simpler one allows you to provide the content, the MIME type, and the encoding, all as strings. Typically, your MIME type will be text/html and your encoding will be UTF-8 for ordinary HTML.

For instance, if you replace the loadUrl() invocation in the previous example with the following code, you get the result shown in Figure 13-2.

browser.loadData("<html><body>Hello, worldk/body></html>", "text/html", "UTF-8");

Figure 13-2. The Browser2 sample application

This is also available as a fully-buildable sample, as WebKit/Browser2.

0 0

Post a comment