Cordova loading local images from CSS - ios

I've a Cordova 5+ application built with Ionic 1 and Angular 1.
I use ViewerJS to load and read PDF files (retrieved from a remote server): I used an iframe making it working.
On desktop browsers, like Chrome, it works perfectly while on Cordova (precisely, on iOS with WKWebView) it throws errors like:
Not allowed to load local resource file://
First of all, those images are loaded from a CSS file (I'm expected that it uses HTTP instead of file protocol):
url(/images/image.png)
Second, this is the signature of the iframe:
<iframe class="row" sandbox="allow-scripts" ng-src="{{::viewerJsUrl}}"></iframe>
Third and last: I've followed this entire guide, tuning the Cordova build as fine as possible -> https://github.com/jessemonroy650/top-phonegap-mistakes/blob/master/the-whitelist-system.md
What am I missing?
Is there a security problem with iframe on Cordova (iOS, using WKWebView)?

Related

Quasar VueJS app with Cordova loads application on iOS simulator with blank page only

I am trying to deploy an iOS app from VueJS Quasar framework using Cordova. When I load the application on the dev environment ( with quasar dev ), it runs the application through a browser and works fine.
However when I "export" to cordova project on iOS platform, in xCode I get the following error in the console: "Failed to load webpage with error: Could not connect to the server" and the simulator loads an empty white blank page only.
The app has been built and tried on an iPhone as well, and it's the same reason: empty blank page.
We are using API in the background from another server as well, where we have set the CORS to allow *.
Note: exported to android platform it works nice.
Did anybody have this problem, and knows what the solution is? Thanks!

Ionic 5 - HTML view

We are building hybrid app using ionic 5, one of the requirement is to open the HTML files downloaded to the local app content folder. The HTML files has reference to js & css files. The difficulty we face is the HTML file opens successfully and the javascript & CSS reerred is not opening. we tried using inappbrowser, window.open, previewanyfule plugin most of them same result. need guidance in opening such files.
If you wish to run your ionic app on an android or iOS device you will need Cordova or capacitor.

Cordova loading XML and JSON files with PreloaderJS (CreateJS) doesn't work

I'm developing an HTML5 game with CreateJS and I'm using Cordova to build for Android and iOS platforms.
The problem is that on iOS, the .xml and .json files are not loaded with PreloaderJS.
I have a xml file and I try to load it:
_loader = new createjs.LoadQueue(false);
_loader.loadFile({src:"assets/generic/levels/landingScreen/xml/logic.xml", type:createjs.AbstractLoader.XML});
It works on web and on Android, but it doesn't work on iOS.
Does anyone have a solution for this?
Thanks!

Phonegap working with Android but not with iOS, Error Code

I am getting this error code when i open a phonegap html site in iOS:
gap:["Device","getDeviceInfo","Device341875241"]
gap:["NetworkStatus","getConnectionInfo","NetworkStatus341875242"]
gap:["App","show","App341875243"]
It is working with Android perfectly.. i am using cordova 2.7.0.
What´s that supposed to mean?
thanks!
You must add the correct cordova-2.7.0.js file that is specific to iOS. This error usually occurs when you add cordova JS file which is not specific to a particular platform. In other words, you should add the iOS specific cordova-2.7.0 JS file to your iOS PhoneGap project.
Possible scenario:
You might have wrongly included the Android specific cordova-2.7.0 JS file in your iOS project.
Fix:
Just remove the current cordova JS file and add the cordova-2.7.0.js file from iOS folder in the downloaded Phonegap-2.7.0 folder

Phonegap App Works in iOS 6 but not iOS 5

All that happens in iOS 5 is the 'DeviceReady' and 'Load' events being fired and all of my files are being loaded
My stack includes:
Cordova 2.2.0rc2
Phonegap ChildBrowser
Phonegap InAppPurchaseManager
BackboneJS
UnderscoreJS
jQuery 1.8.1
jQueryMobile 1.2.0
RequireJS
ParseJS
I can see that the files have loaded because I have the corresponding JS objects:
CDV
window.plugins.childBrowser
window.plugins.inAppPurchaseManager
Backbone
_
$
$.mobile
require
Parse
However, the step that isn't happening is RequireJS loading the main.js file. And why this doesn't happen for iOS 5 when it happens for iOS 6 is extremely confusing.
Any ideas on why this may be happening? I'm very open to trying things.
Thanks a lot!
You could use Weinre to debug the application remotely. This blog post at phonegap.com explains how you can use Weinre to debug your application. It should display any JavaScript errors that your app might produce.

Resources