diff --git a/FCHost/fchost/fchost_handler.cc b/FCHost/fchost/fchost_handler.cc
index 98ce4417d404aebe5f49ae3380e54d80e8c47e38..dede6cac40bb7321ebf5fac7757f116336e12c0e 100644
--- a/FCHost/fchost/fchost_handler.cc
+++ b/FCHost/fchost/fchost_handler.cc
@@ -10,6 +10,7 @@
 
 #include "include/base/cef_bind.h"
 #include "include/cef_app.h"
+#include "include/cef_parser.h"
 #include "include/views/cef_browser_view.h"
 #include "include/views/cef_window.h"
 #include "include/wrapper/cef_closure_task.h"
@@ -19,6 +20,13 @@ namespace {
 
 FCHostHandler* g_instance = NULL;
 
+// Returns a data: URI with the specified contents.
+std::string GetDataURI(const std::string& data, const std::string& mime_type) {
+    return "data:" + mime_type + ";base64," +
+        CefURIEncode(CefBase64Encode(data.data(), data.size()), false)
+        .ToString();
+}
+
 }  // namespace
 
 FCHostHandler::FCHostHandler(bool use_views)
@@ -142,7 +150,8 @@ void FCHostHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
         "<h2>Failed to load URL "
      << std::string(failedUrl) << " with error " << std::string(errorText)
      << " (" << errorCode << ").</h2></body></html>";
-  frame->LoadString(ss.str(), failedUrl);
+
+  frame->LoadURL(GetDataURI(ss.str(), "text/html"));
 }
 
 void FCHostHandler::OnBeforeDownload(CefRefPtr<CefBrowser> browser,