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.

<webview> NewWindow.attach is broken on 0.48.0+

See original GitHub issue

NWJS Version : 0.48.0+ (tested with 0.48.0, 0.48.3, 0.49.0-beta1, all dev) Operating System : Linux x64

Expected behavior

After attaching new window to a webview as documented here you should be able to interact with the page with keyboard and mouse.

Actual behavior

Window is attached to the webview and appears to be responsive. Can interact with the page via DevTools (e.g. set input value). However, clicking on anything within the page has no effect.

It does work correctly using 0.47.3 so I’m hoping it’ll be possible to isolate what broke it.

How to reproduce

package.json

{
  "name": "newwindow",
  "main": "index.html"
}

index.html

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>newwindow</title>
  <style>
    html,
    body {
      width: 100%;
      height: 100%;
    }
  </style>
</head>

<body>
  <webview src="https://www.encodedna.com/javascript/demo/open-new-window-using-javascript-method.htm"></webview>
  <script>
    document.querySelector('webview').addEventListener('newwindow', e => {
      const webview = document.createElement('webview');
      webview.style.width = '50vw';
      webview.style.height = '50vh';
      webview.style.position = 'absolute';
      webview.style.border = 'solid 2px red';
      webview.style.left = '0';
      webview.style.top = '0';
      document.body.appendChild(webview);
      e.window.attach(webview);
    });
    setTimeout(() => {
      nw.Window.get(window).showDevTools();
    }, 100);
  </script>
</body>

</html>

Run it and click on ‘Open new window’ withing the demo page. Try to interact with the popup.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
panther7commented, Oct 8, 2020
0reactions
panther7commented, Oct 10, 2020

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android WebView links to same window with target=_blank to ...
I have a hybrid app that uses WebView to render external html from my own site. It had a problem that if any...
Read more >
WebView - Android Developers
Retrieve a unique token identifying the top-level "real" window of the window that this view is attached to. int[], getAttributeResolutionStack(int ...
Read more >
`<webview>` Tag | Electron
Use the webview tag to embed 'guest' content (such as web pages) in your Electron app. The guest content is contained within the...
Read more >
webview Tag - Google Chrome
Use the webview tag to embed 'guest' content (such as web pages) in your ... attach. NewWindow.attach(object webview). Attach the requested target page...
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