Skip to content

Instantly share code, notes, and snippets.

@sakurabird
Created November 18, 2013 05:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakurabird/7522877 to your computer and use it in GitHub Desktop.
Save sakurabird/7522877 to your computer and use it in GitHub Desktop.
webviewでAndroid4.0の場合、hostにポート番号が付加されてしまう件
// 認証リクエストがあった場合の挙動
@Override
public void onReceivedHttpAuthRequest(WebView view,
HttpAuthHandler handler, String host, String realm) {
// Android4.0の場合、hostにポート番号が付加されてしまうので、splitでポート番号を排除
String[] up = view.getHttpAuthUsernamePassword(
host.split(":")[0], realm);
if (up != null && up.length == 2) {
handler.proceed(up[0], up[1]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment