diff --git a/src/UnityWebBrowser.Engine.Cef/Shared/Browser/UwbCefClient.cs b/src/UnityWebBrowser.Engine.Cef/Shared/Browser/UwbCefClient.cs
index e4df240..1736f6e 100644
--- a/src/UnityWebBrowser.Engine.Cef/Shared/Browser/UwbCefClient.cs
+++ b/src/UnityWebBrowser.Engine.Cef/Shared/Browser/UwbCefClient.cs
@@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
+using System.Text;
using Microsoft.Extensions.Logging;
using UnityWebBrowser.Engine.Cef.Shared.Browser.Js;
using UnityWebBrowser.Engine.Cef.Shared.Browser.Messages;
@@ -289,7 +290,7 @@ public void ProcessMouseScrollEvent(MouseScrollEvent mouseScrollEvent)
///
public void LoadUrl(string url)
{
- browser.GetMainFrame()?.LoadUrl(url);
+ browser.GetMainFrame()!.LoadUrl(url);
}
///
@@ -305,9 +306,12 @@ public Vector2 GetMouseScrollPosition()
/// Loads HTML content
///
///
- public void LoadHtml(string html)
+ public unsafe void LoadHtml(string html)
{
- browser.GetMainFrame()?.LoadUrl($"data:text/html,{html}");
+ html = CefRuntime.Base64Encode(Encoding.UTF8.GetBytes(html));
+ html = CefRuntime.UriEncode(html, false);
+
+ browser.GetMainFrame()!.LoadUrl($"data:text/html;base64,{html}");
}
///
@@ -316,7 +320,7 @@ public void LoadHtml(string html)
///
public void ExecuteJs(string js)
{
- browser.GetMainFrame()?.ExecuteJavaScript(js, "", 0);
+ browser.GetMainFrame()!.ExecuteJavaScript(js, "", 0);
}
///