You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Omit the dialog title of alert() and confirm() #2518
Currently dialogs triggered by alert() and confirm() in Electron has the title of application name specified in package.json.
My application is a multi-language one, so I decided that the name in package.json is always in english for consistancy (the data directory of the app is also determined by application name). However, I don't want non-English spoken users to see the English application name in the title of dialogs because this is not user-friendly.
I think Electron may omit the dialog title of alert() and confirm(), because they are model dialogs so users always know where the dialog come from. Firefox already does this and I feel well with it.
If you want to change the title to some translated text, you can do that with the current release.
It turns out the current implementation extends alert and confirm with a second parameter. If you set it to a non empty string, that string will be displayed as the title of the dialog. For example alert("I am an alert box!", "Foobar"); will show the title Foobar.
I know it's not exactly what you wanted but I thought it might still help you.
Reacted by Claudius Coenen, GalacticDust, Hank Bao, rentu, Emanoel Queiroz, Twometer, Mahesh Bandara Wijerathna, Anand, Jenuel Oras Ganawed, Sonahang Rai and 1 more
If you want full control of the dialog you should use the dialog module, the implementation of alert is for compatibility with existing web pages so we won't give it much flexibility.
I don't see any compatibility issue here. The spec says nothing about the dialog title of alert() etc., and not all browers show a title. Anyway, I use alert(msg, ' ') now as suggested above.
Activity
etiktin commentedon Aug 19, 2015
If you want to change the title to some translated text, you can do that with the current release.
It turns out the current implementation extends
alertandconfirmwith a second parameter. If you set it to a non empty string, that string will be displayed as the title of the dialog. For examplealert("I am an alert box!", "Foobar");will show the titleFoobar.I know it's not exactly what you wanted but I thought it might still help you.
duanyao commentedon Aug 19, 2015
Interesting, it does help, thanks!
zcbenz commentedon Aug 25, 2015
If you want full control of the dialog you should use the
dialogmodule, the implementation ofalertis for compatibility with existing web pages so we won't give it much flexibility.duanyao commentedon Aug 25, 2015
I don't see any compatibility issue here. The spec says nothing about the dialog title of
alert()etc., and not all browers show a title. Anyway, I usealert(msg, ' ')now as suggested above.pjdon commentedon May 23, 2021
@etiktin This did not work for me in version
1.12.4. Was support for this removed? I can't find any information.etiktin commentedon May 23, 2021
@pjdon this is an old closed issue. Many things changed since then, so maybe it's no longer supported. I suggest you open a new issue.