Skip to content

Commit cd0d071

Browse files
authored
Fix Access-Control-Allow-Origin issue (#8)
This option helps to avoid access control errors if HTML or js tries to load png files, fonts and so on from `files:///...` https://developer.android.com/reference/android/webkit/WebSettings.html#setAllowFileAccessFromFileURLs(boolean)
1 parent ca40671 commit cd0d071

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

webview/src/java/com/defold/webview/WebViewJNI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ private WebViewInfo createView(Activity activity, int webview_id)
279279

280280
WebSettings webSettings = info.webview.getSettings();
281281
webSettings.setJavaScriptEnabled(true);
282+
webSettings.setAllowFileAccessFromFileURLs(true);
282283

283284
info.webview.addJavascriptInterface(info.webviewClient, JS_NAMESPACE);
284285

0 commit comments

Comments
 (0)