Disable autocomplete / autofill in Chrome 51 for typeahead

So all the old insane tricks don't seem to work anymore, right? Well, I've seen one where you create a bunch of retarded hidden fields, but that's inelegant and adds too much complexity. So, based on something I found rarely mentioned, I manged to assemble this:

The type "search" makes it to where Chrome will not apply autocoplete or autofill, however some browsers like Firefox still will, so you also add the classic autocomplete="off".

It works with typeahead and Bootstrap 3 just fine, however if you have specific styles for input[type='text'] you'll have to include 'search' as well.

It's also a valid HTML5 element as well, and in HTML4 or (X)HTML 1.x most browsers will fail to text even though it says search, so it may not be valid, but it will work, and that's more important.

So, good luck, until Chrome changes this shit too and wants to punish developers. As they claim, turning off autocomplete isn't really a security feature, that's nonsense because I'm not using it for security.

They say that we should take advantage of autocomplete and autofill, but that logic doesn't seem to include the fact that maybe people other than Google have search suggestions, or even hidden values like numerical IDs which need to be applied when the item is selected — something autofill doesn't do and Google doesn't seem to give a fuck.

Leave a Reply