最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin9浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论