Android WebView + AJAX local files Android WebView + AJAX local files android android

Android WebView + AJAX local files


You need to allow crossdomain. In this example, crossdomain is allowed for json values and for scripts.

$.ajaxPrefilter( "json script", function( options ) {    options.crossDomain = true;});


Thanks for answer @njzk2, I've made it:

$.ajaxPrefilter( 'text', function( options ) { options.crossDomain = true; }); $.ajax({ url: source, type: 'GET', dataType: 'text'

Make it working in firefox, chrome and IE to load a local file ( not through any server )

I was personnaly lacking this parameter which target api 16 at least ( wondering if any other parameter could target any older API )

mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);

thanks