title: Allow remote ajax calls in an Android Webview + jquery mobile
body: <p>I'm developing an javascript/HTML application with jquerymobile which makes ajax requests to a remote server. The application works fine on Chrome (only launching chrome with web security disabled) but when I embed it within the assets/ directory of an Android application (a simple webview) the remote ajax calls fail. Thus I guess it may be a cross domain issue. I'm aware that phonegap does not have this issue but I would like not to use phonegap if possible. So the question is: how do I disable cross domain protection in an Android webview application?</p>
  
  <p>this is the Activity code:</p>
  
  <pre><code>public class Moby extends Activity {
  
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_moby);
  
      WebView mbrowser = (WebView) findViewById(R.id.webView1); //get the WebView from the layout XML
      if (Build.VERSION.SDK_INT &gt;= VERSION_CODES.JELLY_BEAN) 
          mbrowser.getSettings().setAllowUniversalAccessFromFileURLs(true);
      //mbrowser.setWebChromeClient(new WebChromeClient());
      mbrowser.setWebViewClient(new WebViewClient());
      mbrowser.loadUrl("file:///android_asset/index.html"); //set the HTML
      WebSettings settings = mbrowser.getSettings();
      settings.setJavaScriptEnabled(true);
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  </code></pre>
  
  <p>And I already set the jquerymobile cross domain parameters in my html pages:</p>
  
  <pre><code>&lt;script src="script/jquery-1.8.2.js"&gt;&lt;/script&gt;
  &lt;script&gt;
   $(document).bind("mobileinit", function(){
   $.support.cors = true;
   $.mobile.allowCrossDomainPages = true;       
  }); 
  &lt;/script&gt;
  &lt;script src="script/jquery.mobile-1.2.0.js"&gt;&lt;/script&gt;
  </code></pre>