6 comments

[ 1.5 ms ] story [ 22.6 ms ] thread
I wish Safari on iOS came with more documentation...
Seriously?

> Setting the label text to “Name on card” was the magic trick.

I18n, who needs it, everyone prefers English!

Apple is getting into more and more magic like this... Annoying. :/
I see no indication from the article that having the text in a different language would change this. It's probably based on browser locale.
The article said the text attribute had to be set to a specific string "Name on card" for the autofill to work.

You really think that if the browser locale were set to, say, Spanish, then it would work with only some particular spanish translation of 'name on card'? That's awfully... optimistic of you. I suppose it's possible. And someone could try to reverse engineer all the exact string literals expected for each possible browser locale and hope they don't change. It's definitely not a very i18n-friendly solution.

I'd actually be pretty surprised if it really did work like this, and was hard-coded to different `text` attribute strings for different locales. But it's hard to say what exactly Apple's motivation was for the odd details of the undocumented implementation, so hard to predict what they may have done. I guess more reverse engineering could be done. Which is pretty silly. Some `data-*` attributes would probably be the 'right' way to implement this feature, and not any harder to implement than hard-coded id's and `text` attributes; heck, maybe it does support specific data- attributes, they just haven't told anyone about it. Who knows, with no docs.

I honestly have no idea why my comment got downvoted, but that's cool.

Agree with you completely. It's pretty frustrating how it works, and I really wish Apple would release some documentation on this.

I'm sure there is more to be found reverse engineering but once I had enough figured out for our uses I stopped.