Influencing whether browsers prompt to save credentials

懵懂的女人 提交于 2019-12-09 10:16:57

问题


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:

However, for this login page, it doesn't. I can't find any good data on how IE makes the decision whether to present this dialog. How to get IE to show that prompt - assuming no user settings trump it?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/6142725/influencing-whether-browsers-prompt-to-save-credentials

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