禁止打开非http协议链接
parent
331afc37df
commit
d6d6fae2ca
|
@ -54,6 +54,7 @@ app.on('web-contents-created', (event, contents) => {
|
|||
event.preventDefault()
|
||||
if (/^devtools/.test(navigationUrl)) return
|
||||
console.log(navigationUrl)
|
||||
if (!/^https?:\/\//.test(navigationUrl)) return
|
||||
await shell.openExternal(navigationUrl)
|
||||
})
|
||||
contents.on('will-attach-webview', (event, webPreferences, params) => {
|
||||
|
|
|
@ -232,6 +232,7 @@ export const objectDeepMerge = (target, source, mergedObj) => {
|
|||
* @param {*} url
|
||||
*/
|
||||
export const openUrl = url => {
|
||||
if (!/^https?:\/\//.test(url)) return
|
||||
shell.openExternal(url)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue