Can I load some html string by using UniWebView?

Yes, you can load a html string by calling LoadHTMLString method on the webview component. You can specify a base url as a search path for your resources referred in your html string. Please see the script reference and demo code in the package for more.

Notice: you need to encode your base url correctly when you use it. It should be a valid path in the target system. For example, if you put an image file with name "my_image.png" under the Streaming Assets folder and try to load it in a plain html string like this:

<html><body><img src="my_image.png"></img></body></html>

In iOS, the baseUrl should be:

"file:/" + Application.streamingAssetsPath.Replace("/","//").Replace(" ","%20") + "//"

while in Android, it should be:


You could also refer to this post for more information on it.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk