Not able to load content from http domain


I am trying to load content from HTTP domain but it is not working, before android 12 it was working.

I have added the below details in config.xml

<plugin name="cordova-plugin-cleartext"/>
<platform name="android">
        <resource-file src="network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />

network_security_config.xml is as below

<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:android="">
    <base-config cleartextTrafficPermitted="true">
            <certificates src="system" />
    <domain-config cleartextTrafficPermitted="false">
        <domain includeSubdomains="true">localhost</domain>
		<domain includeSubdomains="true"></domain>
        <domain includeSubdomains="true">file:///android_asset/</domain>

Can anyone help?

See here for the right way to do this: Android Platform Guide - Apache Cordova

However, you should probably fix this from the other end and get https enabled on the server.

@JeremyWJ I have followed all the steps, but still it is not working.

Try adding this header to the HTTP content response header:

Access-Control-Allow-Origin: *

But I would also strongly suggest moving to HTTPS.

Check for error messages on the Remote Console - I bet you’ll see the problem there.

mujaffar1, the only “correct” fix for this is to get https enabled. I would really recommend doing that. There is basically no reason these days not to be using https.

Yes, Https is the only solution.