Influencing whether browsers prompt to save credentials

后端 未结 2 653
孤城傲影
孤城傲影 2021-02-15 11:39

For most web pages that have a username and password dialog, browsers will prompt the user if they want to save the credentials for that form:

相关标签:
2条回答
  • 2021-02-15 12:29

    When IE is configured to ask you the question, then it will ask or not depending on the way you submit the form.

    When submiting using an input type="submit" (i.e. a submit button), then IE will ask you if you want to save the password.

    If you use javascript to submit the form, like this document.getElementById('Form1').submit(), it will not ask you to save the password.

    Try this HTML, in IE (I didn't test other browser yet):

    • the submit button asks you to save password
    • the submit link does not ask anything

    Html code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head id="Head1">
        <title>Home Page </title>
        <link href="Styles/Site.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form method="post" action="Default.aspx" id="Form1">
        <div class="aspNetHidden">
            <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODcyMTYwNTY0ZGRfKmsji5yH9OZWyNlRsIwCOz1mu6uALjmUI+04ei8bkQ==" />
        </div>
        User:
        <input name="ctl00$BodyContent$login$UserName" type="text" id="ctl00_BodyContent_login_UserName"
            class="user-name">
        Pass:
        <input name="ctl00$BodyContent$login$Password" type="password" id="ctl00_BodyContent_login_Password">
        <input type="submit" value="Submit">
        <a href="javascript:document.getElementById('Form1').submit();">submit</a>
        </form>
    </body>
    </html>
    

    If you check the box to never ask again, then you can configure that in IE options:

    Tools > Internet Options > Content > AutoComplete

    0 讨论(0)
  • 2021-02-15 12:41

    My guess is that since the page is in HTTPS mode IE is not allowing autocomplete to execute because the page has indicated that HTTP caching should not be allowed.

    Or the form is being submitted with Javascript.

    See this article for more details. http://blogs.msdn.com/b/ieinternals/archive/2009/09/11/troubleshooting-stored-login-problems-in-ie.aspx

    0 讨论(0)
提交回复
热议问题