Hi,
I have a webview with autosize="on" style="width: 100%; height: 100%;", inside a chrome.app.window instance declared with minWidth: 1024, minHeight: 768 attributes. When I resize the main app window, I expected the webview's contents to also resize. Inspecting the DOM for the various views shows that the <webview> element has the new size as expected, but that the DOM of the webview contents still has the original dimensions from launch.
autosize
<webview id="foo" src="http://www.google.com/" style="width:640px; height:480px" autosize="on" minwidth="576" minheight="432"></webview>
If "on", the webview will fire the sizechanged event and adjust the size of the guest content within the webview container, provided you have written event handlers to change these dimensions.
I've tried setting a listener for the sizechanged event:
window.addEventListener('load', function() {
var webview = document.getElementById('econ-webview');
webview.addEventListener('sizechanged', function(event) {
console.log('Size changed:', event.oldWidth, event.oldHeight, event.newWidth, event.newHeight);
});
});
This logs the initial size at launch - Size changed: 0 0 1024 768 - but does not log any further events when I resize the app window.
Does anyone have a suggestion as to what I must do to get the webview contents resizing in tandem with the main app window?
Thanks.