question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The webview tag is not sized properly

See original GitHub issue

Even if an explicit size has been declared, the webview tag is not sized properly when the application starts up. However, if the application’s window is manually resized, then the webview immediately gets resized properly.

Here is an example page that triggers the problem:

<html>

    <head lang="en">
        <style>
            html, body {
                height: 100%;
                margin: 0;
            }
        </style>
    </head>

    <body>
        <webview src="http://google.com/" style="width:100%; height:100%;"></webview>
    </body>

</html>

When the application is launched the webview occupies roughly the height of a single line of text. The problem happens on Mac OS X Yosemite and Windows 8.1.

This is in NW.js 0.13beta2

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:4
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
jamespatrickwhitecommented, Jan 17, 2017

For anyone else that happens to run into this issue, I found that in my case (using 0.19.5-sdk), it wouldn’t change size unless I explicitly set the webview element’s display style property to flex.

ie: <webview src="..." id="..." style="display:flex; height:100%; width:100%;"></webview>

0reactions
tekratcommented, Mar 3, 2019

This is an issue with Chrome / Chromium / Webkit. There is not a fix for this. IFrame’s has the same issue. The workaround is:

  • Position the DIV were you want you want the IFrame or WebView to be
  • Put the IFrame or WebView into the DIV
  • Set the IFrame or WebView to a WIDTH and HEIGHT of 100%
Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Webview - Webpage should fit the device screen
I have tried the following to fit the webpage based on the device screen size. mWebview.setInitialScale ...
Read more >
text-size-adjust - CSS: Cascading Style Sheets - MDN Web Docs
The text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not...
Read more >
Webview API - Visual Studio Code
Use the Webview API to create fully customizable views within Visual ... Our command opens a new webview panel with the correct title,...
Read more >
Supporting different screens in web apps - Android Developers
... always appear at the appropriate size. WebView supports DOM, CSS, and meta tag features to help you ensure that web content is...
Read more >
React Native WebView: A complete guide - LogRocket Blog
React Native WebView renders web content in a native view. Learn some of its tricks and features that you can use to your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found