How to load a local HTML file?

Hi,everyone, as shown in the question,How should I use JUCE to load a local HTML file?

Sadly the WebBrowserComponent doesn’t take a juce::URL (it should).
But using “toString()” will give you a version with the “file://” prefix:

juce::URL url (juce::File::getSpecialLocation (juce::File::userDesktopDirectory).getChildFile ("foo.bar"));
browser.goToUrl (url.toString(false));

Yes, using WebBrowserComponent can display HTML pages, but it always prompts for script errors when loading on Windows, which does not happen on Mac because the document mentions “The browser itself will be platform dependent. On Mac and iOS it will be WebKit, on Android it will be Chrome, and on Linux it will be WebKit.” I don’t know how to solve this problem now.

webBrowserComponent->goToURL("https://docs.juce.com/master/index.html");

image

I don’t know if you’ve ever encountered such a situation?

Might be due to the old WebView engine:

https://docs.juce.com/master/classWebBrowserComponent_1_1Options.html#a07181a9db553b2f0be6a1c1816f46b7fae8aa41a34604c78a4d3ff0613cf474b3

There are a few things to set in order to switch, but I am not an expert on windows.

Good luck

I guess, here the threads merge in your other topic:

Yes, I think so.