# WebBrowserComponent does not work in resizable window

**URL:** <https://forum.juce.com/t/webbrowsercomponent-does-not-work-in-resizable-window/25867>\
**Category:** MacOSX and iOS\
**Created:** [January 9, 2018, 6:31pm UTC](https://forum.juce.com/t/webbrowsercomponent-does-not-work-in-resizable-window/25867 "2018-01-09T18:31:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erysaj](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@erysaj](https://forum.juce.com/u/erysaj)\
**Post date:** [January 9, 2018, 6:31pm UTC](https://forum.juce.com/t/webbrowsercomponent-does-not-work-in-resizable-window/25867/1 "2018-01-09T18:31:16Z")

</div>

Hi all,  
I’m trying to create a simple demo app which embeds HTML page and have encountered a weird issue.  
I’ve created the app skeleton with Projucer 5.2.0, my custom code is minimal:

```
MainWindow (String name) : DocumentWindow (name, Desktop::getInstance().getDefaultLookAndFeel().findColour(ResizableWindow::backgrounColourId), DocumentWindow::allButtons)
{
    setUsingNativeTitleBar (true);
    setContentOwned (new MainContentComponent(), true);
    centreWithSize (getWidth(), getHeight());
    setVisible (true);
    // setResizable(true, true);
}

void MainContentComponent::resized()
{
    auto bounds = getLocalBounds();
    bounds.reduce(10, 20);
    m_browser.setBounds(bounds);
}

MainContentComponent::MainContentComponent()
{
    setSize(800, 600);
    addAndMakeVisible(m_browser);
    m_browser.goToURL("https://google.com");
}

```

So far everything works, but after I enable window resize (by uncommenting the last line in MainWindow’s constructor) web page is no longer shown.  
This reproduces on macOS (I have High Sierra 10.13.2), though I don’t have any other desktop OSes at hand to check there

---

<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 10, 2018, 8:16am UTC](https://forum.juce.com/t/webbrowsercomponent-does-not-work-in-resizable-window/25867/2 "2018-01-10T08:16:51Z")

</div>

Try making the window resizable _first_, before you do anything else to it like adding its content.

When you swap a window between being resizable/non-resizable, the underlying code actually has to tear-down and recreate the whole thing, so if you’ve got complex stuff inside it like embedded web-browsers, there’s a lot of scope for things to not be recreated correctly.

---

<div class="post-metadata">

**Author:** ![erysaj](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@erysaj](https://forum.juce.com/u/erysaj)\
**Post date:** [January 10, 2018, 10:02am UTC](https://forum.juce.com/t/webbrowsercomponent-does-not-work-in-resizable-window/25867/3 "2018-01-10T10:02:24Z")

</div>

That worked out, thanks!
