How to Disable Autofill / Autocomplete in Chrome – jquery.disableAutoFill Plugin
How to Disable Autofill / Autocomplete in Chrome – jquery.disableAutoFill Plugin
disableAutoFill is a lightweight jQuery plugin and easiest solution for disabling Google Chrome auto-fill, auto-complete functions. If you don’t want to display users input data as google chrome default feature support, it stores users data in cookie and when user fill same form it auto suggest past filled data, If you are looking solution for disabling autofill and autocomplete feature of form data to protect user’s sensitive data you can use this plugin.
Integrate disableAutoFill On your Web Form
Libraries
Load required libraries on page, Plugin dependent on jQuery core library include it first then add jquery.disableAutoFill.min.js lib
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script> <script src="https://terrylinooo.github.io/jquery.disableAutoFill/assets/js/jquery.disableAutoFill.min.js"></script>
HTML
Bellow is the sample html form which autofill and autocomplete need to disable.
<form method="post" id="login-form"> Username: <input name="username" type="text" /> Password: <input name="password" type="password" /> <input type="submit" value="Submit"> </form>
JS
Finally call the plugin function on form element to disable autofill and autocomplete feature.
$(function() { $('#login-form').disableAutoFill(); });
Specify the password field when there is no [type=passoword]
field.
$(function() { $('#login-form').disableAutoFill({ textToPassword: true, passwordFiled: '' }); });
Specify the submit button when there is no [type=submit]
button.
$(function() { $('#login-form').disableAutoFill({ submitButton: '' }); });
See live demo and download source code.
DEMO | DOWNLOAD
Visit official github repository for more information and follow for future updates. Don’t forget to read license for using this plugin in your projects.