A variety of methods to achieve 360 browser to prohibit the automatic filling in user name and password

  • 2020-03-30 03:22:58
  • OfStack

Currently developing a project encountered a very disgusting problem, originally in the login interface after entering the user name and password, after choosing to remember the password, in the content page of the < Input type = "text" id = "userName" / > And < Input type = "password" id = "password" / > The user name and password entered in the login interface will be filled in the content page. While the content page is to create a new sub-account, this problem is really called a disgusting bala ~~~

Of course, this is not the case with firefox, IE8 or more. The problem is 360! As expected, this novice after the following attempts:

The first is to cancel the automatic password in the browser.
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201406/201406161715151.gif? 2014516171539 ">  

Unfortunately, this thing didn't respond to the 360, nima, the first attempt failed! (of course, even if it works, as a developer, you can't make all users take this action!)

Second: add the autocomplete="off" attribute to the input so that it does not automatically write the username and password.

Unfortunately, the 360 is immune, too.

Type 3: modify the type attribute of input dynamically through js:

< Input type="text" id="password" onfocus="this.type='password'" />

This time, 360 directly input the password is displayed, that is, onfocus did not execute the following execution, hit a short point, found jquery error. An error occurred with uncaught exception type property can't be changed. Unfortunately, type changes are not supported under IE.

Fourth kind: since hard come not line, that can execute very method only, you don't let me change, that I don't change, I hide you, come a smoke screen!
 
$(function(){ 
$("#PWD").focus(function(){ 
$(this).hide(); 
$("#password").val("").show().css("backgroundColor","#fff").focus(); 
}); 
$("#password").blur(function(){ 
$(this).show().css("backgroundColor","#fff"); 
$("#PWD").hide(); 
}); 
$("#UN").focus(function(){ 
$(this).hide(); 
$("#userName").val("").show().css("backgroundColor","#fff").focus(); 
}); 
$("#userName").blur(function(){ 
$(this).show().css("backgroundColor","#fff"); 
$("#UN").hide(); 
}); 
}); 

Note: background-color is set to # FFF because 360 will default to a yellow background.

Use an input field with an id other than userName and password, and set the style to the same. When we click on the fake input, the real input will be displayed.
 
<input id="UN" maxlength="26" type="text" title=" Please enter a user name " /> 
<input id="userName" name="user.userName" maxlength="26" style="display:none;" type="text" title=" Please enter a user name " /> 
<input id="PWD" maxlength="20" type="text" title=" Please enter your password " /> 
<input id="password" name="user.password" maxlength="20" style="display:none;" type="password" title=" Please enter your password " /> 

Done!

Related articles: