How can I get browser to prompt to save password?

前端 未结 20 1441
面向向阳花
面向向阳花 2020-11-22 16:20

Hey, I\'m working on a web app that has a login dialog that works like this:

  1. User clicks \"login\"
  2. Login form HTML is loaded with AJAX and displayed i
20条回答
  •  耶瑟儿~
    2020-11-22 16:44

    I had similar problem, login was done with ajax, but browsers (firefox, chrome, safari and IE 7-10) would not offer to save password if form (#loginForm) is submitted with ajax.

    As a SOLUTION I have added hidden submit input (#loginFormHiddenSubmit) to form that was submitted by ajax and after ajax call would return success I would trigger a click to hidden submit input. The page any way needed to refreshed. The click can be triggered with:

    jQuery('#loginFormHiddenSubmit').click();
    

    Reason why I have added hidden submit button is because:

    jQuery('#loginForm').submit();
    

    would not offer to save password in IE (although it has worked in other browsers).

提交回复
热议问题