안녕하세요 시작한지 얼마 않되는 초보입니다..
webview 관련하여 간단한 예제 소스를 따라 해봤는데 , 네이버나 다음 ,구글 이런 사이트는 열리는데 ,
제 개인적인 홈페이지는 그냥 까맣게 나오네요..(열리지가 않아요)
왜 그럴까요..? 밑에 예제에서 http://www.seoul.co.kr 도 않되네요...
알려주세요~~
package my.andr_webview;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class HelloWebView extends Activity {
/** Called when the activity is first created. */
WebView webview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://www.seoul.co.kr");
// webview.loadUrl("http://www.naver.com");
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
이 이유가 아닐수도 있지만..
서버에서 특정 user agent 가 아니면 데이터를 주지 않도록 되어 있을 수도 있지 않을까요?
WebView 에다가 loadUrl 을 하지 마시고 직접 html 을 받아서 loadDataWithBaseURL 를 사용해 보시면
더 명확한 이유가 나오실 것 같네요.