How to enable a pop up for authentication for electron?

旧时模样 提交于 2019-12-04 04:21:22

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/44543664/how-to-enable-a-pop-up-for-authentication-for-electron

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!