I am looking for some workaround, how to disable save credentials functionality in web browser after fill in. I have found several solutions but neither of them doesn't work in all browser (all solutions was old and authors tested these "hacks" in older browser versions). I have tested on Chrome, FF, Opera, IE (current versions). In most cases only FF has a problem, it always wanted to save credential. Could someone help me?
Here are some solutions which works for all browsers except FF.
<form action="test.php" method="post" autocomplete="off">
Username:
<input type="text" name="username" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
Password:
<input type="password" name="password" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
<input type="submit" value="Login">
</form> //works for Chrome, IE, Opera; doesn't work FF.
2.)
<form action="test.php" method="post" autocomplete="off">
<div style="display:none">
<input type="password" tabindex="-1"/>
</div>
Username:
<input type="text" name="username" placeholder="username"/>
Password:
<input type="password" name="password" placeholder="password"/>
<input type="submit" value="Login">
</form> //works for Chrome, IE, Opera; doesn't work FF.
3.)
<form action='test.php' class='login-form' autocomplete='off'>
Username:
<input type='user' name='username'>
<input type='hidden' name='user'>
Password:
<input type='password' name='password'>
<input type='hidden' name='password'>
</form> //works for Chrome, IE, Opera; doesn't work FF.
4.)
<form action="test.php" method="post" autocomplete="off">
Username:
<input type="text" name="username" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"
onfocusout="this.setAttribute('readonly','readonly');" >
Password:
<input type="password" name="password" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"
onfocusout="this.setAttribute('readonly','readonly');" >
<input type="submit" value="Login">
</form> //works for Chrome, IE, Opera; doesn't work FF.
5.)
Username:
<input type="text" id="username" name="username"/>
Password:
<input type="password" id="password" name="password"/>
<form id="theForm" action="test.php" method="post">
<input type="hidden" id="hiddenUsername" name="username"/>
<input type="hidden" id="hiddenPassword" name="password"/>
<input type="submit" value="Login"/>
</form>
<script type="text/javascript" language="JavaScript">
$("#theForm").submit(function() {
$("#hiddenUsername").val($("#username").val());
$("#hiddenPassword").val($("#password").val());
});
$("#username,#password").keypress(function(e) {
if (e.which == 13) {
$("#theForm").submit();
}
});
</script>