How can I get browser to prompt to save password?

前端 未结 20 1542
面向向阳花
面向向阳花 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:51

    The browser might not be able to detect that your form is a login form. According to some of the discussion in this previous question, a browser looks for form fields that look like . Is your password form field implemented similar to that?

    Edit: To answer your questions below, I think Firefox detects passwords by form.elements[n].type == "password" (iterating through all form elements) and then detects the username field by searching backwards through form elements for the text field immediately before the password field (more info here). From what I can tell, your login form needs to be part of a

    or Firefox won't detect it.

提交回复
热议问题