如果不想让浏览器缓存input的值,有2种方法:

方法一: 
在不想使用缓存的input中添加 autocomplete="off"; 

<input type="text" autocomplete="off" name="test" />

方法二: 
在 input 所在的form标签中添加 autocomplete="off"; 

<form action="#" autocomplete="off">
  <input type="text" autocomplete="off" name="test" />
</form>

 

input 的属性autocomplete 默认为on,其含义代表是否让浏览器自动记录之前输入的值。

很多时候,需要对客户的资料进行保密,防止浏览器软件或者恶意插件获取到,可以在input中加入autocomplete="off" 来关闭记录,系统需要保密的情况下可以使用此参数。

 

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2021-11-21
  • 2021-11-22
  • 2021-11-22
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2021-07-20
  • 2021-10-20
  • 2021-10-16
  • 2021-05-30
  • 2022-12-23
  • 2021-12-26
相关资源
相似解决方案