zoukankan      html  css  js  c++  java
  • html页面禁止自动填充浏览器记住的密码

    现在的浏览器功能越来越强大,比如Chrome浏览器,在一个系统login的时候我们一般会记住密码,那么在整个系统中,浏览器一旦遇到 type="password"的控件,就会把密码自动填充到该控件。非常烦恼,问了一下同事有人说可以用autocomplete="off" 来禁用自动填充, 经过简单的实践没有达到我的需求。于是回到最原始的解决方案。
    比如html如下

    <input type="password"  name="admin_pwd" minlength="6" required="true" />

    在页面初始化的时候 把type改为text 并且清空,在focus事件触发的时候又把type改为password。
     $("input[name='admin_pwd']").attr("type", "text").val("").on("focus", function () {
                $(this).attr("type", "password");
            });

    当页面ajax提交后又把type改为text且清空该值
      $("input[name='admin_pwd']").attr("type", "text").val("");

  • 相关阅读:
    huffman压缩解压文件
    C++ fstream 详解
    huffman编码
    ios cocoapods
    POI2Vec: Geographical Latent Representation for Predicting Future Visitors
    latex生成pdf 出现missing$ inserted
    矩阵、向量求导法则

    矩阵范数求导
    hive
  • 原文地址:https://www.cnblogs.com/majiang/p/6032776.html
Copyright © 2011-2022 走看看