9

I'm using the following login form in my web app. It works fine in IE7, FF3.6 and Chrome7.0. Except for the fact that Chrome does not seem to recognize this form as a login form and therefore does not offer me to save the username/password. Both FF and IE do offer me to remember the username/password.

Here's the form:

<form name="login_form" id="login_form" action="" method="POST" onsubmit="javascript:handleFunction('action_login', document.getElementById('user_name_id').value, document.getElementById('password_id').value); return false;"> 
    <div class="login_line">name<input name="user_name" id="user_name_id" size="16" maxlength="16" value= "" type="text"></div> 
    <div class="login_line">password<input name="password" id="password_id" size="16" maxlength="16" type="password"></div> 
    <div class="login_line"><input type=submit class="icon icon_accept" value="login"></div> 
</form> <!-- login_form --> 

EDIT: I use jquery (not consistently as you can see), qTip (to show any login errors) and Xajax (as ajax framework). The handleFunction is as follows:

function handleFunction (functionName)
{
    // remove any static qtip from screen
    if ( $('#qtip_close_button').length )
    {
        // click on close button of qtip
        $('#qtip_close_button').click();
    }

    // remove the first argument from the arguments list
    var argArray = $.makeArray(arguments).slice(1);

    xajax.request({ xjxfun : functionName }, { parameters : argArray });
}

Thanks for any advise!

By the way: I checked if my host is in the saved password exceptions list of Chrome. It is not.

jzp74
  • 627
  • 4
  • 9
  • 21

2 Answers2

4

I believe it is because the form is not actually being "submitted". If you check the onsubmit attribute, you can see that it returns false at the end, which cancels the submission.

Kranu
  • 2,557
  • 16
  • 22
  • when I remove "return false", login does not succeed (just tested it to be sure) – jzp74 Nov 07 '10 at 20:22
  • 1
    Yes, it doesn't work when you remove return false. You will need to rewrite your code. Chrome does not offer to save passwords from forms that are not "submitted" as a security feature. If you want the Save Password feature to work, you're going to have to ditch the whole fancy AJAX login. – Kranu Nov 08 '10 at 04:02
  • 2
    @Kranu what's this security issue you mention? I don't think this is a security feature; it's just one more browser crapness we have to deal with. – Roman Starkov May 11 '12 at 17:27
  • It's not a security feature. It's a well acknowledged bug that someone who knows chromium code needs to fix. There is apparently a patch in beta that doesn't completely solve the issue. – Erik Aronesty Nov 26 '13 at 17:08
  • @ErikAronesty Which patch do you mean? Do you have reference? I just opened a bug report: https://code.google.com/p/chromium/issues/detail?id=339927 – mkurz Jan 31 '14 at 22:13
  • Chrome 46 fixed its wrong behaviour - no workarounds needed anymore. See https://stackoverflow.com/a/33113374/810109 – mkurz Oct 14 '15 at 12:07
2

You have to submit form twice:

  1. one with JS validation
  2. and after that plain POST form.

Here is the solution

Community
  • 1
  • 1
iexx
  • 91
  • 1
  • 8
  • Chrome 46 fixed its wrong behaviour - no workarounds needed anymore. See https://stackoverflow.com/a/33113374/810109 – mkurz Oct 14 '15 at 12:07