Solved WebView Doesn't Work in Compiled Plugins and Stand-alone Apps
-
EDIT: Works great now. I don't know if I simply wasn't doing it right, or it started working in later versions.
All you get is a solid white screen when rendering either a remote or local html page. There are many other bugs with WebView, but that is the most serious. (macOS; Ventura; M2; Xcode 14)
-
Finding the same thing here using latest development branch. Tried standalone and plugin builds on macOS.
Is this feature still supported?
-
Yes but it‘s supposed to load embedded data - you can‘t just give it an external URL. There was someone posting an example on how to hack it to load external content but I can‘t find it.
-
@Christoph-Hart I was simply trying to load similar to your example code:
const var f = FileSystem.getFolder(FileSystem.AudioFiles).getParentDirectory().getChildFile("Images/index.html"); WebView1.set("enableCache", false); WebView1.reset(); WebView1.setIndexFile("Images/index.html");
Working in editor, but blank white screen on all build types (on mac anyway).
Or is that still wrong on my end?
-
@dxmachina @Christoph-Hart I did manage to get it working for external websites. On macOS (I don't have Windows or GNU/Linux), it works flawlessly. I'll mark as solved.
dxmachina, this goes somewhere in your script; the component is the HISE web browser.
const var web_DOCS_CoreHTML_GUI = Content.getComponent("web_DOCS_CoreHTML_GUI"); // ------------- CoreHTML Stuff // This file has the redirect to the internet. var startingPage = FileSystem.getFolder(FileSystem.AudioFiles).getParentDirectory().getChildFile("Images/html/index.html"); web_DOCS_CoreHTML_GUI.set("enableCache", true); web_DOCS_CoreHTML_GUI.reset(); web_DOCS_CoreHTML_GUI.setIndexFile(startingPage);
And then the html file, use a meta-tag to redirect:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Plugin Build Information</title> <meta http-equiv="refresh" content="0; URL=https://www.hise.dev" /> <style> h1, h2, h3 { color: #9b64d0; } </style> </head> <body> </body> </html>
-
C clevername27 marked this topic as a question on
-
C clevername27 marked this topic as a regular topic on
-
C clevername27 marked this topic as a question on
-
C clevername27 has marked this topic as solved on
-
@clevername27 that's a cool trick, thanks!
-
@clevername27 Thank you.
Just for clarity, in case anyone else is making rookie mistakes like myself. The main issue for me (just using embedded webview) was:
WebView1.set("enableCache", false);
This had to be set to true in builds or you otherwise end up with just a blank webview in your app/plugins. To be fair, this is in the docs.