We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For example the "powered by Datasette" link, or URLs in tables that get converted into links.
The text was updated successfully, but these errors were encountered:
Relevant documentation: https://www.electronjs.org/docs/api/window-open
Sorry, something went wrong.
This recipe looks good: https://stackoverflow.com/a/67409223
mainWindow.webContents.setWindowOpenHandler(({ url }) => { shell.openExternal(url); return { action: 'deny' }; });
setWindowOpenHandler() only fires for target="_blank" or window.open() - I need to fire for all navigated links. This recipe seems to work:
setWindowOpenHandler()
target="_blank"
window.open()
function postConfigure(mainWindow) { mainWindow.webContents.on("will-navigate", function (event, reqUrl) { let requestedHost = new url.URL(reqUrl).host; let currentHost = new url.URL(mainWindow.webContents.getURL()).host; if (requestedHost && requestedHost != currentHost) { event.preventDefault(); shell.openExternal(reqUrl); } }); }
d19ffec
No branches or pull requests
For example the "powered by Datasette" link, or URLs in tables that get converted into links.
The text was updated successfully, but these errors were encountered: