Search code examples
androidcordovaionic-frameworkcordova-plugins

Whitelist plugin not working; External js fails to load


This is my first post here. Please bear with me if unknowingly I don't go by the rules. So I recently updated Ionic and Cordova to their latest versions on my project (that is Cordova CLI 5.1.1, Gulp 3.8.11, Ionic CLI 1.6.1, Ionic App Lib 0.3.3 and Node 0.10.36).

Ever since I did that I'm getting a lot of hangs and crashes in my app. I made some research and found out that I had to install the whitelist plugin. I did that. I added <access origin="*"/><allow-navigation href="*"/><allow-intent href="*"/> in my config.xml file. I also added <meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-eval' 'unsafe-inline'"> in my index.html file. But again, the app is freezing.

When debugging through Chrome, I can see that none of the external scripts that my app uses are being loaded. Error message examples: Failed to load resource http://maps.google.com/maps/api/js and Failed to load resource http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,700,500italic,900,700italic,900italic

So clearly whitelist isn't doing what it's supposed to do. Unless you think it's something else?

Please help me out! I'd be eternally grateful!

Thanks!

Ako


Solution

  • Never mind, I solved it by having these permissions in AndroidManifest.xml file:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    

    It might help some of you :)