I am embedding a webapp using CefSharp which is all working fine. However, when logging into the app, CEF doesn't offer to remember the username and password like it does when opening the app in normal Chrome.
Is there a way in CefSharp to get cef to ask to remember usernames/password so that when uses go back to the app, they will be able to sign in quicker ?
I have tried using some command line args e.g.
CefSettings cs = new CefSettings();
cs.CefCommandLineArgs.Add("enable-automatic-password-saving", "enable-automatic-password-saving");
cs.CefCommandLineArgs.Add("enable-password-save-in-page-navigation", "enable-password-save-in-page-navigation");
Cef.Initialize(cs);
but so far, cef has not prompted me to save the username/password.
I had the same issue and resolved it by injecting some javascript from the FrameLoadEnd
event. Something like:
void wb_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
{
if (e.Url.Equals(@"https://yyy.zzz.com/"))
{
var wb = sender as ChromiumWebBrowser;
wb.EvaluateScriptAsync
(@"document.querySelector('input#username').value='steve';");
}
}
CefSharp
doesn't support remember password prompt. I don't believe that CEF
does either, though it's probably worth asking on http://magpcss.org/ceforum/ for a definitive answer (There's no reference in the API for the current version).
I'll also point of that unless explicitly told CEF
will use an in memory cookie store, so session cookies won't be persisted. You need to specify CefSettings.CachePath
to persist cookies (and other cache able data).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With