替换过时API
parent
c0a13622b0
commit
7580c79c00
|
@ -55,12 +55,12 @@ app.on('web-contents-created', (event, contents) => {
|
||||||
if (!navigationUrlWhiteList.some(url => url.test(navigationUrl))) return event.preventDefault()
|
if (!navigationUrlWhiteList.some(url => url.test(navigationUrl))) return event.preventDefault()
|
||||||
console.log('navigation to url:', navigationUrl)
|
console.log('navigation to url:', navigationUrl)
|
||||||
})
|
})
|
||||||
contents.on('new-window', async(event, navigationUrl) => {
|
contents.setWindowOpenHandler(({ url }) => {
|
||||||
event.preventDefault()
|
if (!/^devtools/.test(url) && /^https?:\/\//.test(url)) {
|
||||||
if (/^devtools/.test(navigationUrl)) return
|
shell.openExternal(url)
|
||||||
console.log(navigationUrl)
|
}
|
||||||
if (!/^https?:\/\//.test(navigationUrl)) return
|
console.log(url)
|
||||||
await shell.openExternal(navigationUrl)
|
return { action: 'deny' }
|
||||||
})
|
})
|
||||||
contents.on('will-attach-webview', (event, webPreferences, params) => {
|
contents.on('will-attach-webview', (event, webPreferences, params) => {
|
||||||
// Strip away preload scripts if unused or verify their location is legitimate
|
// Strip away preload scripts if unused or verify their location is legitimate
|
||||||
|
|
Loading…
Reference in New Issue