最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - How to enable a pop up for authentication for electron? - Stack Overflow

matteradmin4PV0评论

I am creating an electron app that accesses a url. And when navigated to the URL the user clicks on a button and are redirected to a URL that displays this pop up in Chrome.

How can I enable/show this popup in electron? It doesn't seem to enable it by default.

I am creating an electron app that accesses a url. And when navigated to the URL the user clicks on a button and are redirected to a URL that displays this pop up in Chrome.

How can I enable/show this popup in electron? It doesn't seem to enable it by default.

Share Improve this question asked Jun 14, 2017 at 11:35 orangeorange 5,40513 gold badges54 silver badges73 bronze badges 2
  • I believe you should receive 'login' event for this case, which you can handle – pergy Commented Jun 14, 2017 at 11:51
  • 1 @pergy That is exactly what I needed thanks. If you post it as an answer I will gladly accept it :) – orange Commented Jun 15, 2017 at 8:23
Add a ment  | 

1 Answer 1

Reset to default 5

What you see on the picture is that Chrome opens a popup for handle authentication event.

However, Electron doesn't make such popup by default, as it stated in the documentation of 'login' event

The default behavior is to cancel all authentications, to override this you should prevent the default behavior with event.preventDefault() and call callback(username, password) with the credentials.

This means, you should handle 'login' event of your webContents manually and open a popup window by yourself or do whatever you want.

Post a comment

comment list (0)

  1. No comments so far