Disable Chrome Autofill & Autocomplete With jQuery - disableAutoFill

Disable Chrome Autofill & Autocomplete With jQuery - disableAutoFill

disableAutoFill is a lightweight jQuery plugin for disabling autofill and autocomplete functionalities in Google Chrome browser.

How it works:

  • Add random chars on "name" attribute to avid Browser remember what you submitted before.
  • Replace submit button to normal button to make sure everything works fine.

How to use it:

1. Insert the minified version of the disableAutoFill plugin after loading jQuery JavaScript library.

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" 
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
        crossorigin="anonymous">
</script>
<script src="src/jquery.disableAutoFill.min.js"></script>

2. Call the function disableAutoFill() on the html form and done.

<form id="demo">
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
    <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>
$(function(){
  $('#demo').disableAutoFill();
});

3. Specify the password field when there is no [type=passoword] field.

$('#demo').disableAutoFill({
  textToPassword: true,
  passwordFiled: ''
});

4. Specify the submit button when there is no [type=submit] button.

$('#demo').disableAutoFill({
  submitButton: ''
});

5. The plugin also provides a callback function which can be used to validate the form fields.

$('#demo').disableAutoFill({
  callback: function() {
    return true;
  },
});

This awesome jQuery plugin is developed by terrylinooo. For more Advanced Usages, please check the demo page or visit the official website.

  • Publication date: 01.04.2018
  • Source