FR: Web browser component - loadHTMLString

Hi Juce devs,

I’d like to be able to have the Web Browser component display data from memory, so I can use it as the basis of an in-app (offline) help system.

Historically, it looks like one kind JUCE user tried adding a loadHTMLString method c.f. this link:

It’d be really, really useful if something like this could be be re-added, but of course with support for iOS, macOS, Windows, Android.

Perhaps there is a reliable work-around that could be used on all the above, using some sort of file:// URL, where the app writes the files to a specific temporary folder, and the web browser can load from there. However, if that is possible, I really can’t see what folder path (from the JUCE app side, and from the file:// … side) I’d need to use for either iOS or Android (Windows/macOS would be easy). If anybody out there knows, I’d be very happy to hear!

Best wishes to all,

Pete

FWIW, I think that on Android, a URL can be loaded from the app’s assets folder like this:

Assets : Stored in the apk. Read-only access. URL takes form file:///android_asset/myFolder/myFile.html

And from internal storage:

  • Internal storage: Each app has its own, file names are relative to this location. URL takes form file:///myFolder/myFile.html

See:

Pete

macOS/iOS - use resources in your bundle:

  NSURL* url = [[NSBundle main] URLForResource:@"myfolder/myfilebasename" withExtension:@"html"];
  juce::String urlString = "file://" + juce::String::fromUTF8(url.path.UTF8String);
  webBrowser->goToURL(urlString);