[Android] Webview 404 ¿¡·¯ ó¸® |
|
|
![](icon/private_name/1.gif) |
7³â Àü |
* URL Á¢±Ù µµÁß ÀÎÅͳÝÀÌ ²÷±æ°æ¿ì Æ˾÷â È°¼º
WebView.setWebViewClient(new WebViewClient() {
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
switch (errorCode) {
case ERROR_AUTHENTICATION: // ¼¹ö¿¡¼ »ç¿ëÀÚ ÀÎÁõ ½ÇÆÐ
case ERROR_BAD_URL: // À߸øµÈ URL
case ERROR_CONNECT: // ¼¹ö·Î ¿¬°á ½ÇÆÐ
case ERROR_FAILED_SSL_HANDSHAKE: // SSL handshake ¼öÇà ½ÇÆÐ
case ERROR_FILE: // ÀÏ¹Ý ÆÄÀÏ ¿À·ù
case ERROR_FILE_NOT_FOUND: // ÆÄÀÏÀ» ãÀ» ¼ö ¾ø½À´Ï´Ù
case ERROR_HOST_LOOKUP: // ¼¹ö ¶Ç´Â ÇÁ·Ï½Ã È£½ºÆ® À̸§ Á¶È¸ ½ÇÆÐ
case ERROR_IO: // ¼¹ö¿¡¼ Àаųª ¼¹ö·Î ¾²±â ½ÇÆÐ
case ERROR_PROXY_AUTHENTICATION: // ÇÁ·Ï½Ã¿¡¼ »ç¿ëÀÚ ÀÎÁõ ½ÇÆÐ
case ERROR_REDIRECT_LOOP: // ³Ê¹« ¸¹Àº ¸®µð·º¼Ç
case ERROR_TIMEOUT: // ¿¬°á ½Ã°£ ÃÊ°ú
case ERROR_TOO_MANY_REQUESTS: // ÆäÀÌÁö ·ÎµåÁß ³Ê¹« ¸¹Àº ¿äû ¹ß»ý
case ERROR_UNKNOWN: // ÀÏ¹Ý ¿À·ù
case ERROR_UNSUPPORTED_AUTH_SCHEME: // Áö¿øµÇÁö ¾Ê´Â ÀÎÁõ ü°è
case ERROR_UNSUPPORTED_SCHEME:
WebView.loadUrl("about:blank"); // ºóÆäÀÌÁö Ãâ·Â
AlertDialog.Builder builder = new AlertDialog.Builder(MyView.this);
builder.setPositiveButton("È®ÀÎ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// È®ÀιöÆ° Ŭ¸¯½Ã À̺¥Æ®
}});
builder.setMessage("³×Æ®¿öÅ© »óÅ°¡ ¿øÈ°ÇÏÁö ¾Ê½À´Ï´Ù. ¾îÇÃÀ» Á¾·áÇÕ´Ï´Ù.");
// builder.setMessage("³×Æ®¿öÅ© »óÅ°¡ ¿øÈ°ÇÏÁö ¾Ê½À´Ï´Ù. ÆäÀÌÁö¸¦ À̵¿ÇÕ´Ï´Ù.");
builder.setCancelable(false); // µÚ·Î°¡±â ¹öÆ° Â÷´Ü
builder.show(); // ´ÙÀ̾ó·Î±×½ÇÇà
break;
}}}); |
|
̵̧ : 337 |
̵̧
¸ñ·Ï
|
|