阻止360瀏覽器自動填充表單

第一種方法:(html)html

在表單裏的上方加入一樣name的隱藏域web

 

<input type="hidden" name="Name" />chrome

<input type="hidden" name="Password" />瀏覽器

 

第二種方法:(單獨區分360瀏覽器 js)ide

if( window.chrome && window.chrome.webstore && Object.keys(window.chrome.webstore).length < 3 ){  //判斷是否360瀏覽器this

  $(':text', ':password').each(function(){  //遍歷不須要自動填充的元素htm

    //複製該元素(this.outerHTML)並添加到後面,而後隱藏該元素並置name屬性爲空rem

    //只能隱藏而不能使用remove方法去除該元素,不然失效input

       $(this).after(this.outerHTML).attr('name', '').hide();        io

     })

}

相關文章
相關標籤/搜索