V5.6β : How to use an external browser with the open method

Previously, using the built-in open method would launch external links (https://) in an external browser.
However, starting from version 5.6β, the site is displayed in a built-in (or dedicated?) window.
Is this the expected behavior?

For plugins, I can handle this as follows:

import { shell } from "electron"
// 略
shell.openExternal(url)

For init.js, I can handle it like this:

const { shell } = window.require('electron');
// 略
shell.openExternal(url)

Hi Shimizu-san,

I believe that the behavior of Electron’s shell.openExternal hasn’t changed in v5.6.0-beta.0.
I tried your code to reproduce it, but it opened the URL in Chrome as expected on macOS.

I can reproduce it in the developer tools console.

M2 Macbook Air - Ventura 13.5.2

But you are calling window.open instead of shell.openExternal in the developer console, no?

In version 5.5.3, doing the same thing opens it in an external browser. What is the reason for this difference?

My English is broken, so I’ll also write in Japanese.

v5.5.3 と v5.6.0 で open を呼んだ際の挙動が違います。
url を引数として渡した場合 (例: https://google.com)、
v5.5.3 では外部ブラウザでサイトが開きます。
v5.6.0 では Inkdrop のウインドウ?が開いてその中でサイトが表示されます。

v5.6.0 での挙動の変化に対応するために shell.openExternal を呼ぶことで対応できますが、
挙動が変わったことが想定通りなのかを気にしています。

open の引数にノートの id を渡した場合はそのノートが開くので
Inkdrop が内部的に open を書き換えて引数によって挙動を変えているのだと思っていました。
この認識が違いますか?

Thanks for the clarification! Got it. It looks like the event ‘new-window’ has been deprecated in the recent Electron.
I found there is a new way to handle opening new windows:

will fix it.

1 Like

It should be fixed in v5.6.0-beta.1! Thanks again for reporting🙌

1 Like