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

MySQL 5.7.11 zip installation and configuration method graphic tutorial

1. Download the MySQL 5.7.11 zip installation pac...

How to upload the jar package to nexus via the web page

When using Maven to manage projects, how to uploa...

Detailed explanation of how to migrate a MySQL database to another machine

1. First find the Data file on the migration serv...

Solve the problem that vue project cannot carry cookies when started locally

Solve the problem that the vue project can be pac...

CentOS 7.9 installation and configuration process of zabbix5.0.14

Table of contents 1. Basic environment configurat...

Vue Basic Tutorial: Conditional Rendering and List Rendering

Table of contents Preface 1.1 Function 1.2 How to...

UDP connection object principle analysis and usage examples

I wrote a simple UDP server and client example be...

Automatically log out inactive users after login timeout in Linux

Method 1: Modify the .bashrc or .bash_profile fil...

MySQL optimization: use join instead of subquery

Use JOIN instead of sub-queries MySQL supports SQ...

Detailed steps to install docker in 5 minutes

Installing Docker on CentOS requires the operatin...

Automatic line breaks in html pre tags

At this time, you can use overflow:auto; (when the...

Vue uses dynamic components to achieve TAB switching effect

Table of contents Problem Description What is Vue...

jQuery achieves full screen scrolling effect

This article example shares the specific code of ...

MySQL query method with multiple conditions

mysql query with multiple conditions Environment:...