Skip to content

Instantly share code, notes, and snippets.

@pyeongho
Last active January 17, 2017 03:59
Show Gist options
  • Save pyeongho/66a50062921216dfae7a1abb9e8cb94e to your computer and use it in GitHub Desktop.
Save pyeongho/66a50062921216dfae7a1abb9e8cb94e to your computer and use it in GitHub Desktop.
private class mWebViewClient extends WebViewClient {
@Override
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error){
StringBuilder sb= new StringBuilder();
if (error != null) {
switch (error.getPrimaryError()) {
case SslError.SSL_EXPIRED:
sb.append("이 사이트의 보안 인증서가 만료되었습니다.\n");
break;
case SslError.SSL_IDMISMATCH:
sb.append("이 사이트의 보안 인증서 ID가 일치하지 않습니다.\n");
break;
case SslError.SSL_NOTYETVALID:
sb.append("이 사이트의 보안 인증서가 아직 유효하지 않습니다.\n");
break;
case SslError.SSL_UNTRUSTED:
sb.append("이 사이트의 이 사이트의 보안 인증서는 신뢰할 수 없습니다.\n");
break;
default:
sb.append("보안 인증서에 오류가 있습니다.\n");
break;
}
}
sb.append("계속 진행하시겠습니까?");
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage(sb.toString());
builder.setPositiveButton("진행", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.proceed();
}
});
builder.setNegativeButton("쥐소", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.cancel();
}
});
final AlertDialog dialog = builder.create();
dialog.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment