I've tried adding an Electron WebView to a basic app and set minwidth and minheight on it as shown below. When it loads though it always ends up as 784px X 150px
<webview id="webpage" src="https://www.duckduckgo.com/" autosize="on" minwidth="800px" minheight="1200px"></webview>
To make an Electron app run in full-screen mode when it's started, pass the following configuration option when creating the BrowserWindow instance: mainWindow = new BrowserWindow({fullscreen: true});
Unlike an iframe , the webview runs in a separate process than your app. It doesn't have the same permissions as your web page and all interactions between your app and embedded content will be asynchronous. This keeps your app safe from the embedded content.
Call mainWindow. maximize() to maximize the window after you create it. Save this answer.
A BrowserView can be used to embed additional web content into a BrowserWindow . It is like a child window, except that it is positioned relative to its owning window. It is meant to be an alternative to the webview tag.
This is an issue other people have reported too. Here in atom discussion webview autosize.
It seems that 'autosize' doesn't say the last word about the resulting window size; css parameters may interfere and change the result.
There are some css workarounds proposed for this issue that may help:
Set html and body width to 100%:
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
Set viewport relative units in webview css:
webview {
display: block; /* iframes are inline by default */
border: none; /* Reset default border */
height: 80vh; /* Viewport-relative units */
width: 95vw;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With