Load image using ng-src in android ionic aplication

后端 未结 1 385
暗喜
暗喜 2021-01-16 15:24

I\'m developing an application using ionic, iOS, and Android, too. I have to load external images using ng-src at url:

http://test.url.eu:1337/fileuplo

1条回答
  •  粉色の甜心
    2021-01-16 15:39

    I had a similar problem where the app worked great on PC but 404's on android. Depending on your Cordova version, as seen at Cordova Android 4.0.0 announcement, since Cordova 4.0.0 it could be you must add the cordoba-

    Whitelist functionality is revamped

    • You will need to add the new cordova-plugin-whitelist plugin to continue using a whitelist
    • Setting a Content-Security-Policy (CSP) is now supported and is the recommended way to whitelist (see details in plugin readme)
    • Network requests are blocked by default without the plugin, so install this plugin even to allow all requests, and even if you are using CSP.
    • This new whitelist is enhanced to be more secure and configurable, but the Legacy whitelist behaviour is still available via a separate plugin (not recommended).
    • Note: while not strictly part of this release, the latest default app created by cordova-cli will include this plugin by default.

    To install: Cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git.

    After this you'll need to add the mandatory content security policy: (a simple one to try out is: but i would recommend reading about the options at http://content-security-policy.com). Don't forget to check your config.xml for defining access origin (simplest is ). If still does not work have a look at https://github.com/apache/cordova-plugin-whitelist#navigation-whitelist to see if you require navigation or intent white-listing. Good luck!

    0 讨论(0)
提交回复
热议问题