I am developing a javascript / HTML application with jquerymobile that makes ajax requests to a remote server. The application works fine on Chrome (only launching Chrome with website protection disabled), but when I paste it into the assets / Android directory of the application (simple web browsing), remote ajax calls fail. So, I think it might be a cross domain problem. I know that the phone book does not have this problem, but I would not want to use the handset, if possible. So the question is: how do I disable cross-domain protection in an Android web browser application?
this is the operation 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);
}
<uses-permission android:name="android.permission.INTERNET" />
And I already set the jquerymobile cross domain parameters in my html pages:
<script src="script/jquery-1.8.2.js"></script> <script> $(document).bind("mobileinit", function(){ $.support.cors = true; $.mobile.allowCrossDomainPages = true; }); </script> <script src="script/jquery.mobile-1.2.0.js"></script>
android ajax jquery-mobile cross-domain android-webview
sproing
source share