javascripthtmlnode-webkit

nw.js: <Webview> does not appear, how to get it to show?


I am using nw.js to render the following index.html file which fails. Inspecting the element shows webview in the html code but it does not bother loading the desired url. How do I get it to display the target website in webview element with NW.js?

<!DOCTYPE html>
<html>
  <head>
    <title>Hello World</title>
    <style>
      * {
        font-family: sans-serif;
      }
      #webview {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        display: inline-flex !important;
      }      
    </style>
  </head>
  <body>

    <webview id="webview" src="https://reactjs.org" partition="trusted" />    

  </body>
</html>

Solution

  • Don't use a webview. There's been discussion around removing support for them. Use an iframe, if you really need to show a remote site.

    That said, many people are using webviews right now without issue. Based on the documentation, I'm guessing you're missing the required entries in your manifest file: https://docs.nwjs.io/en/latest/References/webview%20Tag/