Reputation: 618
We have an application with a login screen which has input field text and password. What I am trying to achive here is;
The things I tried;
autocomplete="off"
on both form and inputs but with
the new Firefox version, it doesn't seem to work.autocomplete="new-password"
but internet explorer
completely ignores it.. (like I am surprised)So if anyone achieved a good result with any other solutions, and if it could be shared, it would be a great contribution to developer community.
Upvotes: 5
Views: 3767
Reputation: 563
You should put text input box inside a canvas.
Take a look at CanvasInput and canvas-text-editor.
By using canvas to draw input box you can trick browsers.
or you can use contenteditable
on a div.
Upvotes: 1
Reputation: 10867
This is Tricky
The reason is browser always watch input field type when we submit.
example
<input type="password">
when use div tag browser does not show (save popup)
example(you want to write some huge logic to hide password)
<div contenteditable="true">username</div>
<div contenteditable="true">password</div>
otherwise you want to manually disable autofilling and popup in your browser
Upvotes: 0
Reputation: 761
You cannot do this while using an input field for passwords. I also strongly advise against you using a regular input field, because many browsers save inputs to those too (but in plain text).
Using a text box inside a canvas is not good for accessibility, and it also is completely incompatible with older browsers.
Your best bet is going to be creating a hidden div
that you can type in via contenteditable
, and then creating a fake password entry overlay that adds a •
every time you type a character. This has the exact same level of treatment from the browser as a regular password input, but the browser won't prompt you to save it.
Upvotes: 1
Reputation: 186
This cannot be prevented from scripts, the only way to prevent is you can disable Autofill in Browser Settings.
Upvotes: 6