Chrome Autofill covers Autocomplete for Google Maps API v3

None of the above answers worked for me (Chrome 64.0.3282.186, x64 windows).

TL;DR: The Google Maps code is changing the autocomplete attribute to off, so even if you set it to new-password, you’ll still get autofill. The hack I’m using is to listen for mutations on that attribute and then override it. Note: simply changing the attribute after calling into Google Maps does not work.

Set up a MutationObserver before initializing Google Maps Autocomplete that immediately stops listening for mutations and then sets the attribute to new-password.

    var autocompleteInput = document.getElementById("id-of-element");

    var observerHack = new MutationObserver(function() {
        observerHack.disconnect();
        $("#id-of-element").attr("autocomplete", "new-password");
    });

    observerHack.observe(autocompleteInput, {
        attributes: true,
        attributeFilter: ['autocomplete']
    });

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)