0
votes

My objective is to fire a web event whenever my client fills in his form using google chrome's autofill feature (https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill).

I believe this is not possible unless google provides a plugin/api out-of-box which indicates that the autofill profile existed and has been chosen by the user to fill in his form. Can peers throw more light on this?

[Edit] Please note that this auto fill (by chrome) is user triggered, rather than the ones which we usually see browsers doing (like username/password, which happens at page load). Hence, the java script solution as prescribed in many other answers may not work here. My questions is very specific to the autofill profile which google chrome maintains, to help people checkout forms faster.

1

1 Answers

0
votes

From this article:

Workarounds

The bottom line is that your JavaScript code can't rely on the change event. If your code needs to know when the value of a field changes, you have two choices:

  1. Have some JavaScript code that runs at a regular interval, checks the value of all the fields, and calls your change handler when it notices that a value has changed.
  2. Disable autocomplete by adding autocomplete="off" on the element. This technique has been supported by browsers since IE 5 (March 1999) and Netscape 6.2 (October 2001), and now made its way into HTML5.

The interval solution (1) seems pretty nice, as safe interval time in HTML5 is 4ms, reffering to this question.

So you can probably assume that filling one input in 4ms is filling it by hand, and filling more than one is autofill.