我做了一個經過驗證的搜索網頁視圖,它在登錄時通過用戶名和密碼進行身份驗證。每次我通過搜索在webview上,它都會彈出用戶已經登錄的認證信息(我相信errorcode 410)。我如何壓制或隱藏它?如何在web視圖中隱藏或隱藏身份驗證彈出窗口?
我應該使用下面的代碼嗎?
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText(view.getContext(), "Authentication Error", Toast.LENGTH_LONG).show();
if (errorCode == 410) {
//webview.setHttpAuthUsernamePassword(host, realm, username, password);
// Show alert to enter username and password.
// Then, when those are entered in the alert,
// set it through the setHttpAuthUsernamePassword(...)
// shown below and then reload the site.
}
super.onReceivedError(view, errorCode, description, failingUrl);
}
如果是這樣,我該如何去抑制或隱藏代碼彈出?
那麼,我絕對不會使用HTTP 410(請參閱[RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html))。你可能會想到401.就抑制彈出窗口而言,你必須找出/給出更多關於它如何顯示或者它的代碼的信息。 – kabuko