tonejac
tonejac

Reputation: 1103

Is there anything in my AndroidManifest.xml preventing external JS and CSS from loading?

Here's my AndroidManifest.xml for my Cordova Android App:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10016" android:versionName="1.0.16" package="com.winetrackerco.app" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleInstance" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="winetrackerco" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:host=" " android:pathPrefix="/" android:scheme=" " />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
        </provider>
        <provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" />
        </provider>
    </application>
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

Is there anything in here that would prevent my external javascript and css files from loading, OR something missing that I need to add in order to get them to load?

Here are the non-loading files in question:

<link rel="stylesheet" href="https://app.winetracker.co/dist/application.min.20171213v2.css">
<script src="https://app.winetracker.co/dist/thirdparties.min.20171213v2.js"></script>
<script src="https://app.winetracker.co/dist/application.min.20171213v2.js"></script>

Upvotes: 0

Views: 383

Answers (3)

tonejac
tonejac

Reputation: 1103

Thanks for your answers. It turns out I had a missing 'intermediate certificate' in my SSL setup that was causing the release version of the APK to refuse to load the JS and CSS files.

enter image description here

I reconfigured the SSL certs on my NGINX server and everything is working great now! Wooh!

Upvotes: 0

AnasAbubacker
AnasAbubacker

Reputation: 3607

Not sure about cordova, but android Web view will load external js if following settings enabled

WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);

Follwing flag also help to load external js as some of the js needs dom storage enabling .

WebSettings.setDomStorageEnabled(true)

Upvotes: 1

Manjunath Davanam
Manjunath Davanam

Reputation: 305

Can you try with cordova plugin whitlist and Content Security Policy

I hope with this we can block the js and css files

Upvotes: 1

Related Questions