I'm writing a login system for a website, but when the user gets the login credentials wrong the browser (I've tried both Firefox and Chrome) still asks if the user wants to save the password. How can I tell the browser that there was a login failure, so that it knows not to ask the user to save the bad credentials?
I've tried sending HTTP status codes of 403 and 500 (instead of the normal 200), but neither work. Is there a way to do what I want?
P.S. I don't want to use the HTTP 401 authentication mechanism as I want to use an HTML form to login, not some browser dialog box.