Having a spot of bother with web browser component
I have this below and I console out the url. I override pageAboutToLoad and it says page about to load is google then it gets called again with about black. The component shows. I read somewhere you need to define the allowed urls but not sure how. On mac…
webView = new AdvertComponent();
addAndMakeVisible(webView);
webView->setBounds(0, 0, 500, 300);
webView->goToURL(“https://google.co.uk”);
Cool but is there any anything bool/method that I can key off in my loop to test if WK runs Async. Otherwise it may work fine on my mac but on slower macs it may not initialise. Can’t seem to find anything obvious in the docs
Not really got anything like that, but assuming that it does its initialisation on the message thread, it should be pretty safe to run a timer with a short period like 500ms, because if the webview blocks the message thread while busy, it’ll also delay the timer.
Windows not showing WebBrowserComponent but building the demo examples does work perfectly. Is there something similar to App Transport Settings in VS2015 ?
My component is nearly identical to the demo one and I have tried a massively delayed start…
mainWindow = new MainWindow (getApplicationName());
mainWindow->setResizable(false,false); // this is added to stop window being resizable
in my Main.cpp on an audio app.
This was actually the culprit for stopping the mac WebBrowserComponent working as well as Windows. The work around on mac was the delayed call to goToURL but that didn’t work on windows. So I suspect that sub windows/frames/components to do with WBC are inheriting something from the mainWindow when setResizable is specified.
My question is, Can setResizable be specified on the mainWindow and something to do with WBC be reset so it works like it does before setResizbale is specified.
To recreate the core of the problem just create an Audio App;
in the mainComponent add this with a scopedPointer.
webView = new WebBrowserComponent();
addAndMakeVisible(webView);
webView->setBounds(0, 0, 500, 300);
webView->goToURL("https://google.co.uk");
And build. Which works fine. Then under
mainWindow = new MainWindow (getApplicationName());