Kitkat Kills: Not Allowed to Load Local Resource: File:///Android_Asset/Webkit/Android-Weberror.Png

Kitkat kills: Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png

"Not allowed to load local resource" is a security origin error. The KitKat WebView has stronger security restrictions and it seems like these are kicking in. FWIW I tried just loading a file:///android_asset URL and it worked fine.

Did you call any of the file-related WebSettings APIs (like setAllowFileAccess(false)) by any chance? Are you trying to load the resource from an https: URL?

Not allowed to load local resource:file:///android_asset phonegap

You need to use InAppBroswer plugin for that.

cordova plugin add cordova-plugin-inappbrowser

Plugin found here

Xamarin Android Webview: Not allowed to load local resource file:///android_asset/*.css source: (1)?

This issue should implementing the WebViewClient with a shouldInterceptRequest override like this thread.
Kitkat kills: Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png

Facebook token auth fails on Android but not browsers

Ok, I solved it. It was due to omniauthWindowType: window.cordova == undefined ? 'sameWindow' : 'inAppBrowser' that always used sameWindow.

Android - How to load external javascript files within at runtime generated HTML data?

It seems the Javascript same origin policy is the root of the problem. The WebView will only load javascript files which are from the same origin as the html. Since no origin for the html was given, the data scheme is used as default. If, however, the data is loaded with the same base url as the javascript files, no problem arises.

Load the html data (with file:///android_asset/javascript/ being the directory of the javascript files):

webview.loadDataWithBaseURL("file:///android_asset/javascript/", page, "text/html", "UTF-8", null);

Then reference the javascript files like this inside the html:

<script src='jquery-1.8.2.js' type='text/javascript'></script>
<script src='src_javascript.js' type='text/javascript'></script>


Related Topics



Leave a reply



Submit