I load into WebViewsome HTML containing two iframes. These 2 iframewill point to pages in my personal folder. So basically I:
page.html (in the folder with assets)
...
<body>
<iframe src="page_1.html" />
<iframe src="page_2.html" />
</body>
...
Webview.java:
String pageContent = readeFileContents("page.html", getActivity().getAssets());
webView.loadDataWithBaseURL("file:///data/data/com.mypackage/", pageContent, "text/html", "UTF-8", null)
Then, if in mine page.htmlI try to access the contents of iframes, I get the following:
Unsafe JavaScript attempt to access frame with URL file:////data/data/com.mypackage/page_1.html from frame with URL file:////data/data/com.mypackage/. Domains, protocols and ports must match.
(I get the same error for both page_1, and of page_2course.)
I try this on the galaxy 2 tab of Android 4.1.2
source
share