Webview open new window in a new webview


#1

I am developing an app with browser feature.

Open new window by create new BrowserWindow:

myBrowserWindow.webContents.on(‘new-window’, (event, url) => {
event.preventDefault()
const win = new BrowserWindow({show: false})
win.once(‘ready-to-show’, () => win.show())
win.loadURL(url)
event.newGuest = win
})
Now, I want do same thing, but I want to replace BrowserWindow by webview tag.

rootWebView.webContents.on(‘new-window’, (event, url) => {
event.preventDefault()
const newWebView = document.createElement(‘webview’)
newWebView.setAttribute(‘src’, url)
document.body.appendChild(newWebView)
event.newGuest = newWebView
})
How can I implement this feature?
Help me! Thanks.


#2

Do you solve this problem i have same issue!