1

Here is the code :

<form method="post" action="default.aspx" id="form1" autocomplete="off">
       <div class="loginContnet">           
           <input " name="SC_Login1$txtUserCode" type="text" id="SC_Login1_txtUserCode" class="txtUserCode" autocomplete="off">
           <input  name="SC_Login1$txtPassword" type="password" id="SC_Login1_txtPassword" class="txtPassword" autocomplete="off">
           <input type="submit" name="SC_Login1$btnOK" value="OK" id="SC_Login1_btnOK" class="btnOK">     
       </div>
</form>

Why all browsers except Mozilla ask save password and how to prevent that?

Amit Chowdhury
  • 623
  • 1
  • 7
  • 20
Iskuhi
  • 23
  • 5

5 Answers5

2

Indeed, browsers do not give a shit about autocomplete="off" attribute for password saving / restoration.

I did encounter the same problem recently and solved it with a nice shiny and beautiful hack as you can see below. The trick consists in having two fields corresponding to login and password with display: none;, hence the browser believe it is the actual login and password fields! Haha, stupid browser!

<form>
  <input type="text" id="email" name="email" size="40" autocomplete="off" />
  <input type="text" style="display: none;" name="loginForAutoCompleteDisable" />
  <input type="password" style="display: none;" name="passwordForAutoCompleteDisable" />
  <input type="password" id="password" name="password" autocomplete="off" />
</form>

Hope this helped!

Louis GRIGNON
  • 634
  • 4
  • 15
1

autocomplete=off only tells the browser not to show suggestions based on your browsing history.

It has nothing to do with save-password

Amit Joki
  • 53,955
  • 7
  • 67
  • 89
  • Not true. [HTML5 says](http://www.w3.org/html/wg/drafts/html/master/forms.html#autofocusing-a-form-control:-the-autofocus-attribute) "When an element's autofill field name is "off", the user agent **should not remember the control's data**, and should not offer past values to the user." – Alohci Apr 18 '14 at 09:47
0

as far as I know, the autocomplete-attribute is used for showing suggestions based on your prior entered values. it has nothing to do with the "save-password"-question. I dont think you can disable the "save-password"-question by html, because it's up to every single client.

Homungus
  • 1,068
  • 1
  • 10
  • 17
  • but there are many pages that doesn't ask saving password, then how they do that? – Iskuhi Apr 18 '14 at 08:40
  • If you are interested in more information, read e.g. this entry http://stackoverflow.com/questions/2398763/how-does-browser-know-when-to-prompt-user-to-save-password – Homungus Apr 18 '14 at 08:46
0

The only problem using this attribute is that it is not standard (it works in IE and Mozilla browsers).
Answer to this question

Community
  • 1
  • 1
Bhavik
  • 4,508
  • 3
  • 25
  • 43
0
<form method="post" action="default.aspx" id="form1" autocomplete="off">
       <div class="loginContnet">           
           <input name="SC_Login1$txtUserCode" type="text" id="SC_Login1_txtUserCode" class="txtUserCode" autocomplete="off">
           <input  name="SC_Login1$txtPassword" type="password" id="SC_Login1_txtPassword" class="txtPassword" autocomplete="off">
           <input type="submit" name="SC_Login1$btnOK" value="OK" id="SC_Login1_btnOK" class="btnOK">     
       </div>
</form>
amit
  • 1