2
votes

This is quite a common question but the solutions I found in other people posts are either related to a specific browser (mostly firefox) or incorrect usage of names (name="U12-678132-34")

My issues are with browsers other then Firefox (Firefox all ways works).

The form that I use is pretty standard HTML form but the submission of it is done with javascript (jQuery AJAX).

Firefox all ways asks to remember the password (if it is a new user) and refills the form if you land on that same page again. But when it comes to Chrome/Safari/IE8-9 then they never request to save a password if the form is submitted with javascript. (By the way I did check if the browsers dont have the - never remember passwords turned on)

My submit happens when you click on the link inside the form or if you just click the "ENTER" button on your keyboard, then it initiates the $.submit() method.

Is there a specific way that the submit needs to occur so that the browser would request to save a password like firefox does? or is there a way to at least tell a specific browser like Chrome/IE to force that type of request?

Form example:

<form class="loginform" method="post" action="">
    <div class="inputfield">
        <input name="email" type="text" class="emailaddress inputclass" value="" title="Email Address" />
    </div>      
    <div class="inputfield">
        <input name="password" type="password" class="password inputclass" title="Password" value="" />
    </div>              
    <div class="submit">
        <a href="javascript:void(0);" class="signinbutton"></a>
        <div class="checking">
            <img src="/preloaders/login-preloader.png"/>
        </div>
        <input type="submit" name="submit" value="submit" style="display:none"/>
    </div>
</form>
5
We have validations added for confirmation of inaccurate login attempt or to many login attempts and password reset. I know that making this form submit without javascript would resolve the issue but we would sacrifice the aesthetics, which is not an option for this project.Alex

5 Answers

3
votes

This is browser behaviour and can't really be changed. Firefox might be "smart" enough to offer to save passwords without the form actually being submitted, but that risks having buttons in the form also trigger that option even if the button does something different. So in my opinion, it's a bad thing for Firefox to do (I've had many problems with Firefox submitting forms even though it shouldn't).

If you really want the save password option to show up, use an iframe and submit to the iframe, instead of using AJAX. You could then use AJAX from the iframe to keep the old behaviour.

0
votes

attach click event to your submit button

$('#id_of_submit').click(function() {
   /your ajax logic
   return false;
});

and on link

$('#id_of_your_link').click(function() {
   $('#id_of_submit').click();
});

this will do the trick.

0
votes

Looking at the answer accepted on here - How can I get browser to prompt to save password? - it seems that a valid action might help.

But i would suggest its down to browser behaviour and cannot be controlled by HTML and/or JavaScript. If you want to remember the values entered use a Cookie

0
votes

As u r doing an AJAX post, then-

  1. Remove the <form> tags

  2. instead of <input type="submit", use button

  3. take the field values & AJAX post- on button click event

it might do the trick.

0
votes

One of the reason is that site should have a valid certificate. If it is not secured site, password save prompt will not appear after login.