# WebbrowserComponent on Mac not showing

**URL:** <https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468>\
**Category:** General JUCE discussion\
**Created:** [January 2, 2017, 7:03pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468 "2017-01-02T19:03:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 2, 2017, 7:03pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/1 "2017-01-02T19:03:13Z")

</div>

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](https://google.co.uk)”);

---

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 2, 2017, 9:02pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/2 "2017-01-02T21:02:13Z")

</div>

So I got the NS App Transport settings correct but can’t get this working and tested against the Demo but still this is blank white component

```
webBrowser =new WebBrowserComponent();
addAndMakeVisible(webBrowser);
webBrowser->setBounds(0,0,400,300);
webBrowser->goToURL("http://nammick.com");
```

---

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 2, 2017, 9:51pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/3 "2017-01-02T21:51:50Z")

</div>

K figured this one as well…

I needed to delay the goToUrl function then it works for some reason…

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 3, 2017, 7:44am UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/4 "2017-01-03T07:44:09Z")

</div>

Yup, not too surprised. Presumably the webkit plugin is ignoring any URL requests until it’s finished initialising.

---

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 3, 2017, 10:05am UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/5 "2017-01-03T10:05:59Z")

</div>

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

Pseudo method

```
if(webview->isReady()) {
    webview->goToUrl("http://juce.com");
}
```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 3, 2017, 11:00am UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/6 "2017-01-03T11:00:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 4, 2017, 4:14pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/7 "2017-01-04T16:14:58Z")

</div>

Damm,

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…

---

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 4, 2017, 4:50pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/8 "2017-01-04T16:50:20Z")

</div>

Well spank a doodle doo.

It turns out that in my main.cpp file

```
mainWindow->setResizable(false,false);

```

Was messing up WebBrowserComponent somehow. I comment it out and it works…  
Is there anyway the WBC can be stopped from inheriting on windows?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 4, 2017, 5:31pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/9 "2017-01-04T17:31:57Z")

</div>

“stopped from inheriting”? Not sure what you mean…

---

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 4, 2017, 6:38pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/10 "2017-01-04T18:38:31Z")

</div>

I added

```
    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());

```

In Main.cpp add this line

```
    mainWindow->setResizable(false,false);

```

And build and the WBC doesn’t work properly.

---

<div class="post-metadata">

**Author:** ![nammick](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nammick/32/2169_2.png) [@nammick](https://forum.juce.com/u/nammick)\
**Post date:** [January 4, 2017, 6:48pm UTC](https://forum.juce.com/t/webbrowsercomponent-on-mac-not-showing/20468/11 "2017-01-04T18:48:53Z")

</div>

OK I figured that I shouldn’t be calling setResizable in that way on in the DocumentWindow constructor.
