-1

I am making a mobile application with Apache Cordova. My index.html file is simple:

<!DOCTYPE html>
<html>
    <head>
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" type="text/css" href="css/index.css">
        <title>Hello World</title>
    </head>
    <body>
        <div class="app">
            <h1>Apache Cordova</h1>
            <div id="deviceready" class="blink">
                <p class="event listening">Connecting to Device</p>
                <p class="event received">Device is Ready</p>
            </div>
            <img style="width:100%;" src="https://i.stack.imgur.com/OFl3d.jpg" />
            <img style="width:100%;" src="original.jpg" />
        </div>
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
    </body>
</html>

It's not complicated:

I want to see 2 pictures:

Online picture

http://www.diana.dti.ne.jp/~june1/perfume/perfume_voce.jpg

Picture in same folder than index.html

original.jpg

I don't know why, it works on iOS 8.4 but doesn't work on iOS 9.0

▽ Sorry Stackoverflow blocks my screenshot (because I am a new member), so you can see this pictures on this page: https://openclassrooms.com/forum/sujet/apache-cordova-impossible-de-voir-image-externes

This is your picture:

on iOS 8.4

enter image description here

on iOS 9.0

enter image description here

Where is my error and why it's doesn't it work on iOS 9.0 now?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
OfficeBit
  • 1
  • 3

1 Answers1

1

Probably your http request is blocked by default in ios.

You have to set the NSAllowsArbitraryLoads key to YES under NSAppTransportSecurity dictionary in your .plist file.

refer to this link: Transport security has blocked a cleartext HTTP

Community
  • 1
  • 1
Peter Peng
  • 1,910
  • 1
  • 27
  • 37