2017-07-28 80 views
1

當網頁上有兩個單獨的登錄字段時,我的瀏覽器(Google Chrome)假定它們都需要相同的憑據,這不是有效的假設。我會喜歡我的瀏覽器分別存儲憑據到他們每個人。如何在網站上的多個登錄字段上使用自動填充

<form id='login-form' method = "post" action = "/login.html"> 
    <ul> 
     <li><input id = "username" name = "username" type = "text" placeholder = "Username"/></li> 
     <li><input id = "password" name = "password" type = "password" placeholder = "Password"/></li> 
     <li><input id = "button" type = "submit" value = "Login"/></li> 
    </ul> 
</form> 

在另一個HTML頁面:

<form id='dx-login-form' method = "post" action = "/dxLogin"> 
    <ul> 
     <li><input id = "dx_username" name = "dx_username" type = "text" placeholder = "Username"/></li> 
     <li><input id = "dx_password" name = "dx_password" type = "password" placeholder = "Password"/></li> 
     <li><input id = "button" type = "submit" value = "Login"/></li> 
    </ul> 
</form> 

回答

0

你可以給第二登錄表單自動完成不同的標識符,這樣就不會從第一個登錄表單自動填充。

<li><input id = "dx_username" name = "dx_username" type = "text" placeholder = "Username" autocomplete = "dx_username" /></li> 
    <li><input id = "dx_password" name = "dx_password" type = "password" placeholder = "Password" autocomplete = "dx_password" /></li> 

欲瞭解更多信息:https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill

+1

它不工作。當我登錄主登錄時,chrome詢問我是否更喜歡記住登錄憑證。我說是的,當我到達第二個登錄表單時,我剛剛在第一個表單上輸入的憑證是自動完成的。當登錄到第二個表單時,Chrome會再次詢問是否應該存儲密碼。我說是的,當我再次輸入第一個表格時,建議將表格的第二個表格提交給我們。 – user2810330

相關問題