안드로이드 개발 질문/답변
(글 수 45,052)
전에 한번 글을 올린적이 있는대요.
WebView 로 페이지를 로딩하였을때 asp 페이지의 <a href="...">aa</a> 테그가 동작하지 않아서 다시 한번 문의 드립니다.
HTML 페이지의 코딩은 다음과 같습니다
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <title>Insert title here</title> </head> <body> <a href="test_pdf.pdf">pdf</a> </body> </html>
이것으로 main2.asp 와 main2.html 파일 2개를 만들었습니다.
그런후 main2.html 과 test_pdf.pdf 파일을 안드로이드 프로젝트안에 assets 폴더에 넣고
main2.asp 와 test_pdf.pdf 파일을 IIS 루트 폴더 넣고 호스팅을 시작하였습니다. (IIS 는 window7 에 기본 설치 가능한걸로 설치했습니다.)
이후 WebView로 assets 폴더 안에 있는 다음 index.html 파일을 읽었습니다.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=euc-kr" /> <title>무제 문서</title> <frameset rows="30%,70%"> <frame src="main2.html" name="top"> <frame src="http://192.168.1.135/main2.asp" name="main"> </frameset> </head> <body> </body> </noframes></html>
위처럼 프레임을 상하 2개로 나눈후 하나는
안드로이드 apk 안에 있는 main2.html 을 부르고 하단부는 IIS 로 호스팅 되고 있는 asp 파일을 불렀습니다.
mWebView.loadUrl("file:///android_asset/index.html");
이후 웹뷰에 다운로드 리스너로 경보창과 로그로 다운로드 링크 정보를 볼수 있도록 했습니다.
mWebView.setDownLoadListener(new DownLoadListener(){ @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Log.i(LOGTAG,"onDownloadStart"); Log.i(LOGTAG,"url " + url); Log.i(LOGTAG,"userAgent " + userAgent); Log.i(LOGTAG,"contentDisposition " +contentDisposition); Log.i(LOGTAG,"mimetype "+mimetype); Log.i(LOGTAG,"contentLength " + contentLength); new AlertDialog.Builder(SMCmobile.this) .setTitle("SMC Mobile System") .setMessage("url : "+url+"\nuserAgent : "+userAgent+"\ncontentDisposition : "+contentDisposition+"\nmimetype : "+mimetype+"\ncontentLength : "+contentLength) .setPositiveButton(android.R.string.ok, null) .create() .show(); } });
어플 실행후 상단 main2.html 은 경보창 및 로그가 찍히지만
하단부분 IIS 로 호스팅 되고 있는 asp 페이지는 아무런 반응을 하지 않습니다.
아시는분 충고 부탁드립니다 ㅠㅠ