Skip to content

cdvfile: not loading local cordova.js on IOS (even without https) #347

Closed as not planned
@manusis

Description

@manusis

Bug Report

Problem

I am trying to load local cordova.js from a remote URL in my cordova(phonegap) application.

  1. I am using http for the remote URL (to avoid mixed content warning).

  2. I have added content security policy in the meta tag of my remote URL

<meta http-equiv="Content-Security-Policy" content="img-src * 'self' 'unsafe-inline' data:;default-src * gap://ready file: cdvfile: data:;style-src * 'self' 'unsafe-inline'; font-src * 'self' data:; script-src * 'self' file: cdvfile: 'unsafe-inline' 'unsafe-eval'">
3. I have added access origin

<access origin="*" /> <access origin="cdvfile://* />

I even tried the following:
<access allows-arbitrary-loads-for-media="true" allows-arbitrary-loads-in-web-content="true" allows-local-networking="true" origin="*" />

  1. I am using <script src="cdvfile://localhost/bundle/www/cordova.js"> to load the cordova file?

I still keep getting the following error on IOS simulator (iphone X 11.0.1)

'An error occurred trying to load the resource.'

What else I might be missing?

Information

What is expected to happen?

Expecting the local cordova.js to load when using remote URL in my cordova application.

Command or Code

<script src="cdvfile://localhost/bundle/www/cordova.js" ></script>

Version information

MacOS 10.13.6 (High Sierra)

phonegap cli-8.1.1
cordova-plugin-file 6.0.2
iphone X 1.1.0.2 (Simulator)

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions