admin管理员组

文章数量:1023794

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.

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.

本文标签: javascriptHow to enable a pop up for authentication for electronStack Overflow