Internal window.open in a webview


#1

I have a webview inside my app that I primarily use to access external websites.

One particular external website has some JS in its page:

newWin = window.open("https://google.com");
settimer = setInterval(counting, 500);
function counting() {
  if (newWin.closed) {
    clearInterval(settimer);
    console.log('closed')
  } else {
    console.log('still open')
  }

Since this website is opened inside a webview, the window.open line doesn’t seem to actually open a page and thus the newWin variable cannot keep track of an opened page (the console of the webview says “Cannot read property ‘closed’ of null”)

**Question: How can I successfully allow my app to open a new window so that newWin can keep track of the new window is open or closed? **

Thanks!