Perfect solution to Google Chrome autofill problem

Perfect solution to Google Chrome autofill problem

In Google Chrome, after successful login, Google Chrome will prompt whether to remember the password. If you choose to remember the password, the following will appear when you log in again:

If the product requirement is that you do not want the browser to automatically fill in the account and password, how can you remove it?

The first thing that comes to mind is to set the input tag attribute autocomplete="off", which does not work.

Then I tried setting css input:-webkit-autofill, setting the background color to transparent and setting the corresponding font color, but it was still unsatisfactory.

Then, according to a method provided on the Internet, add an additional fake input element, which is initially visible. After the document is loaded, use setTimeout to hide the fake input.

The time set by setTimeout is 1ms. I don't know if the way I implemented it is wrong or what, it still doesn't work 3.

Then a thought suddenly popped up in my mind: if the input box does not exist when the document is initialized, and then is injected into the document node after the document is loaded successfully, will the browser not automatically fill it in?

As expected, the input box will no longer be filled, and it's done, hahahaha

Since the project is based on Vue, the late insertion of elements is relatively simple to implement. The code is as follows:

<template>
  <div>
    <input v-if="isShow" type="text">
  </div>
</template>
<script>
  export default {
    data(){
      return {
        isShow:false
      }
    },
    mounted(){
      setTimeout(()=>{
        this.isShow = true;
      },1)
    }
  }
</script>

This is the end of this article on how to perfectly solve the Google Chrome auto-fill problem. For more relevant Google Chrome auto-fill content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  A very detailed tutorial on installing rocketmq under Docker Desktop

>>:  Introduction to local components in Vue

Recommend

Several methods of implementing carousel images in JS

Carousel The main idea is: In the large container...

Use SQL statement to determine whether the record already exists before insert

Table of contents Determine whether a record alre...

MYSQL master-slave replication knowledge points summary

An optimization solution when a single MYSQL serv...

CSS to achieve zoom in and out close button (example code)

This effect is most common on our browser page. L...

How to implement the paging function of MyBatis interceptor

How to implement the paging function of MyBatis i...

CentOS 8 installation diagram (super detailed tutorial)

CentOS 8 is officially released! CentOS fully com...

Shell script settings to prevent brute force ssh

The shell script sets access control, and the IP ...

Summary of basic usage of CSS3 @media

//grammar: @media mediatype and | not | only (med...

Share the responsive frameworks commonly used by web design masters (summary)

This article introduces and shares the responsive...

Example analysis of the usage of the new json field type in mysql5.7

This article uses an example to illustrate the us...

MySQL query optimization: causes and solutions for slow queries

Friends who are doing development, especially tho...

Solution to the failure of docker windows10 shared directory mounting

cause When executing the docker script, an error ...

Summary of Nginx location and proxy_pass path configuration issues

Table of contents 1. Basic configuration of Nginx...

Rainbow button style made with CSS3

Result: Implementation code: html <div class=&...