Sree Sree - 6 months ago 58
HTML Question

How to prevent a browser from storing password

I need to stop the browser from storing the username & password because I'm working on the web application which contains more secure data. My client asked me this.

I tried

attribute in HTML form & password field. but it is not working in the latest browsers like Chrome 55, Firefox 38+, IE 11...etc.

What is the best solution for this?

Answer Source

Thank you for giving reply to me. I followed the below link

Disable browser 'Save Password' functionality


I resolved the issue by just adding readonly & onfocus="this.removeAttribute('readonly');" attributes besides autocomplete="off" to the inputs as shown below.

<input type="text" name="UserName" autocomplete="off" readonly 
onfocus="this.removeAttribute('readonly');" >

<input type="password" name="Password" autocomplete="off" readonly 
onfocus="this.removeAttribute('readonly');" >

This is working fine for me.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download