Previous 1 2 Next 16 Replies Latest reply: Mar 17, 2016 11:23 AM by Grant Wray
davidksalazar Level 1 Level 1

How can I disable safari from saving a user/pass from a form using html or javascript?

I've had this issue that came up with safari 7.0.2 where you can save a user/pass to a keychain and when you goto that same form it automatically overrides those fields? Personally I think this is horrible behavior. I don't think fields should ever be overridden.


I've created an isolated version that you can demo the issue here.


Steps to replicate (ensure you use latest safari 7.0.2)

1. Type and user/pass click save. It should prompt you to save to keychain, accept the save.

2. Now click on the link load random data and you will notice that safari will now be overriding those fields with your perviously saved fields.

iMac (27-inch Late 2009), OS X Mountain Lion (10.8.1)
  • sterling r Community Specialists Community Specialists

    Hello DavidKSalazar,


    It sounds like you are being prompted to save your password to a keychain and you want it to stop. From what you describe it seems like iCloud Keychain is turned on. You can use this info to close it in your Settings:

    Devices using iOS 7.0.3 or later:

    1. Go to Settings > iCloud and turn Keychain on.

    From: iCloud: Frequently asked questions about iCloud Keychain



    Thank you for using Apple Support Communities.

    All the best,


  • davidksalazar Level 1 Level 1

    I'm not interested in knowing how to disable the keychain from safari.  I want to know how I can disable it on the end users side for the form.  Please reread my post. 

  • davidksalazar Level 1 Level 1

    I thought this was goign to work but it didn't.

  • Kingoftypos Level 3 Level 3

    Have you tried removing the keychain for said website? For example, the one that you provided. I followed your instructions.


    Typed "tester" in the username section. Then "user" in the password section. When prompted to save the password, I clicked save.


    Closed the window and went back to it. I saw that both fields were taken up, "tester" and "****" for user. I clicked on Load random data into fields. Saw the random data, but then Safari overridden them.


    Went into Safari---> Preferences---> Passwords and deleted the password associated with that website. Went back and clicked on Load Random Data Into Fields and it did just that.


    I know it's not exactly what you are looking for, but it's an option.


    Besides, I've had more than one Yahoo email address. If I were to double click the username, it gave me the option for both email addresses with their own password.



  • davidksalazar Level 1 Level 1

    I do not want a solution that involves messing with browser preferences. I want a solution that I can do for all users. 


    If you can't wrap your head around a scenario where this would be necessary. Think about this. You have a multi user environment let's say a cms. When you try to edit or create a new user record, safari asks to save it to keychain. Now whenever they try to edit an existing user record it now overrides the fields with the one saved on the keychain. Can you understand how this behavior can be unacceptable and how simply disabling that on safari or manually deleting the saved keychain entry is not a long term solution to this issue.

  • Kingoftypos Level 3 Level 3

    Then click on "Never for this Web Site."



  • davidksalazar Level 1 Level 1

    I can't rely on other users doing it.

  • coranda Level 1 Level 1

    The problem is in the default behaviour of Safari.  We can't expect novice users to make browser configuration changes.


    As an illustration of the problem:


    I administer a site and registered users have a profile page where they can change various parameters - including their email address.  Whenever a user goes to their profile page in Safari 7 it immediately overwrites their email field with their username.  They then can't save any changes to their profile until they replace their username with  a valid email address.  Why is Safari putting their username into an email address field?


    I can prevent this behaviour by allowing users to change their username and hence exposing that field in their profile.  This is not ideal as I don't want people changing their identity at will.  However, this doesn't solve the underlying problem because when I, as the administrator, visit a user's profile it overwrites their email address with my username.


    This is definitely a bug and not a feature.  A field that has a value tag, or autocomplete set to off, should not be overwritten by the browser.

  • davidksalazar Level 1 Level 1


  • davidksalazar Level 1 Level 1

    I submitted this as a bug here i suggest anyone with this issue do the same so they can fix this.

  • James Cook2 Level 1 Level 1

    This is a serious security issue. After you've logged out, another person on the same computer can log in to your account without even trying - just opening the page.


    As a site owner it's a problem where we have very private data and have our pages written to prevent autofill. Safari recently began ignoring it and we have privacy at risk.

  • coranda Level 1 Level 1



    Thanks for the link. Bug report lodged.

  • calsoft Level 1 Level 1

    Hacky Solution....


    I wrapped my login control around a div and set display:none.  I then used some JavaScript (JQuery) to wait a 1/2 second after the document was loaded and then displayed the div.  Since the fields are not visible the browser has nothing to fill.  They are coming up blank every time. 


    Not the best solution, but will work until they are ready to start respecting autocomplete=off.


    <div id="control" style="display:none">

    ...login fields




                                $(document).ready(function () {


                                    setTimeout(function () {


                                    }, 500);




    Hope This Helps...



  • davidksalazar Level 1 Level 1

    Here is a temporary fix.


    Add another password field as a dummy field. It appears to prevent safari from autofilling or saving.


    <input type="password" name="dummypass" value="dummypass" style="display: inline; width: 0; height: 0; border: 0;" />

Previous 1 2 Next