很遗憾,这玩意对360毫无反应,尼玛,第一种尝试失败!(当然,即便生效,作为一个开发者,不能让所有用户都采取这种操作!)

第二种:给input增加autocomplete="off">
Home > Web Front-end > JS Tutorial > Various methods to prevent automatic filling of username and password in 360 browser_jquery

Various methods to prevent automatic filling of username and password in 360 browser_jquery

WBOY
Release: 2016-05-16 16:44:19
Original
1648 people have browsed it

I am currently developing a project and encounter a very disgusting problem. I originally entered the username and password on the login interface to log in. After choosing to remember the password, the on the content page appears. And will fill in the username and password entered on the login interface in the content page. The content page wants to create a new sub-account. This problem is really disgusting~~~

Of course, this will not happen in high-end browsers such as Firefox and IE8 or above. The problem is with 360! Living up to expectations, this rookie has tried the following:

The first one: Cancel the automatic password filling in the browser.
Various methods to prevent automatic filling of username and password in 360 browser_jquery

Unfortunately, this thing has no response to 360, damn, the first attempt failed! (Of course, even if it takes effect, as a developer, you cannot let all users take this action!)

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

Unfortunately, this thing is also immune to 360, it’s a damn thing!

The third method: dynamically modify the type attribute of input through js:



This time 360 ​​directly displays the entered password, that is, the onfocus is not executed. Make a short click and execute the following, and find that jquery reports an error. The error uncaught exception type property can't be changed occurs. Unfortunately, IE does not support modification of type.

The fourth type: Since force is not enough, we can only implement extraordinary measures. If you don’t let me change, then I won’t change. I will hide you and use it as a cover-up!

Copy code The code is as follows:

$(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: Set background-color to #fff because 360 ​​will give a shit yellow background by default.

Use an input box with an ID other than userName and password respectively, and set the style to the same. When we click on the fake input, let the real one be displayed.
Copy code The code is as follows:




< input id="password" name="user.password" maxlength="20" style="display:none;" type="password" title="Please enter your password" />

You're done!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template