Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Safari on iOS7 prompting to save card data

Tags:

html

ios7

safari

I have a client's site which is prompting them to save card details under iOS7. I can find absolutely nothing regarding how or what is causing iOS to decide this is the right thing to do - does anyone have any ideas?

screenshot

like image 600
LuckySpoon Avatar asked Nov 26 '13 06:11

LuckySpoon


2 Answers

We were running into this exact issue. As Guy Thomas mentioned, it was due to having password fields in the form with the CC fields.

After lots of testing, I determined that the password fields could be switched to a different type before submitting the form (in our case, just switched to hidden). This allowed the form to submit even after choosing "Not Now" in the dialog.

$("#submit").on("click", function(){
    try{
        $("input[type=password]").attr("type", "hidden");
    } catch(ex){
        try {
            $("input[type=password]").prop("type", "hidden");
        } catch(ex) {}
    }          
});

I added the try/catches because depending on browser/jquery version, changing the type attribute would error.

like image 124
ry4nolson Avatar answered Oct 07 '22 17:10

ry4nolson


After performing quite a bit of testing on this I determined that there is some kind of analysis being done on the data actually input by the user. I removed all references to credit card, number, cvv, etc. and was still receiving the icloud keychain popup when I entered a "real" card number.. As soon as I started putting in "1234567890123456" and the like, the pop up would not display.

More problematic was when a user would click "not now" the form would not submit without a complete page refresh. I tracked this down to the form having an input of type="password".. As soon as I changed the type to "text", the form would properly submit after the user clicked "not now".

like image 23
Guy Thomas Avatar answered Oct 07 '22 18:10

Guy Thomas