Is there any easy way to set the contents of a webview to an HTML string (without having to load a file)?
Thanks
[[webView mainFrame] loadHTMLString:htmlString baseURL:someURL];
(Where someURL
is used to resolve relative URLs in the HTML source.)
[webView loadHTMLString:yourString baseURL:[[NSBundle mainBundle] bundleURL]];
You can use [[NSBundle mainBundle] bundleURL]
if you desire to load stylesheets(css) or javascripts(js) files that are in your resources dir, if not, just use nil
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With