2014-07-20 1 views
1

페이지 A가 포함 된 WebView가 있습니다. 페이지 A에 페이지 B가 포함 된 iframe이 있습니다. 페이지 A와 B는 모두 앱의 자산입니다.애셋의 페이지가있는 iframe의 Android WebView postMessage

I/chromium(997): [INFO:CONSOLE(27)] "Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.", source: file:///android_asset/path/to/my.js

나는 파일이 자산하지만 그들에게 허용 할 수있는 방법이 있기 때문에 기원이 null 인 가정

페이지 A는 메시지 이벤트 핸들러를 가지고 페이지 B는 parent.postMessage 호출하지만 보안 문제를 얻을 수 이런 식으로 의사 소통을 하는가?

답변

0

페이지 내에서 파일 액세스를 활성화해야합니다. 이 설정을 사용

webView.getSettings().setAllowFileAccessFromFileURLs(true); 

편집 :

이 설정은 SDK 버전에서 유효 (16)