androidcordovacordovawebview

My URL is converted from HTTPS to HTTP using Cordova


In cordova, I have a link which opens a HTTPS url.

<a href="https://example.com/">Click Here</a>

From the Network tab in Chrome developer tools I can see two records:

Why Cordova or WebView converted my URL from HTTPS to HTTP?

URL tested with Chrome desktop without any errors.


Solution

  • Check if your project has the whitelist plugin

    cordova plugin ls
    

    if the list does not show the whitelist plugin then install the plugin

    cordova plugin add cordova-plugin-whitelist
    cordova prepare
    

    if it is already install then add this line to the config.xml to allow access to the all request.

    <allow-navigation href="*" />
    

    to give access to only http and https.

    <allow-navigation href="http://*/*" />
    <allow-navigation href="https://*/*" />
    

    if the issues persist please post your config.xml

    Hope this helps.