Webview autosize


I made a simple application which uses webview, something like this:

<div class="header">Some header stuff</div>
<div class="pane"
    <webview id="foo" src="https://www.github.com/" autosize="on" ></webview>

While width works fine and does reside as I resize the window, webview’s height is set to 150px. I tried to set

minheight="200" maxheight="1000"

but no changes in height.
I can do standard jQuery trick by subscribing to window resize event and setting height as

$(window).height - $('header').height

but I thought autosize is intended to do this?


You might want to have a look at this https://github.com/steelbrain/Brauser/blob/master/Assets/Styles/Base.css#L31


I’ve tried to modify style properties in dev tools, but something overrides my “height: 100%” css property. And I can not understand what it is, because it is not in the devtool style panel where overrides are shown. Confused.

I have feeling that there is something special about size of webview, because “autosize” propery is passed into native code. Documentation doed not say how exactly size is calculated in “autosize” mode.
In fact, here is function responsible for seeting the size:
But I could not make breakpoint working there.


Did you find a fix for this? I also have a webview section that is getting sized to 150px height for some reason.


No, I never were able to make autosize working, so I just used dom window resize event to calculate and set size of webview element explicitly.


I got it to work with a few changes:

First, set h/w = 100% on html and body.

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;

Then set a min size for the webview element:

<webview src="http://www.github.com/" autosize="on" minwidth="600" minheight="800" ></webview>


This issue is still a thing for me a month later, your fix does not work for me. I assume you meant to have width and height 100% in the webview’s css?

EDIT: FOUND IT. My resizing issues was caused by WebFrame.setZoomFactor


What does that mean? I have an webview that is always restricted to 150px in height regardless of css or element styles :frowning:


find a css workaround:

webview {
    display: block;       /* iframes are inline by default */
    border: none;         /* Reset default border */
    height: 80vh;        /* Viewport-relative units */
    width: 95vw;


If this is still a problem for anyone, I’ve found that setting the webview body’s CSS to 100% width and height fixes this problem.

body {
    width: 100vw;
    height: 100vh;


Thank you It worked