Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-10946

dynamically load JS/CSS file into index.html doesn't work with cordova-ios 4.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 6.0.0
    • None
    • Ionic
    • None
    • Ionic 1.7.14, Cordova 6.0.0, iOS devices

    Description

      I use a plugin called cordova-app-loader to update our app from resource server so that if we only change JS/html/css files, we don't need submit to apple for review. It works perfectly before with old Cordova which generate iOS3.9.2 build. After upgrading Cordova to 6.0.0, the generated iOS version is now 4.0.1 and it doesn't work anymore.

      I checked into the issue and found that even I remove the updating from resource server part, only load the js files to index.html dynamically, the app will freeze after load all the js files.

      Details of my current process:

      1. In my index.html file's head, there is some lib js files like cordova.js etc. Among them, the last js file is my bootstrap.js
      2. the bootstrap.js file will read a manifest.json file(which include file paths need to be add to index.html dynamically) and get all the js files need be loaded.
      3. Add all these files into index.html with the following code:
              var el,
              head = document.getElementsByTagName('head')[0],
              src = the_path_to_the_js_file,
              now = Date.now();
              el= document.createElement('script');
              el.type= 'text/javascript';
              el.src= src + '?' + now;
              el.async = false;
              head.appendChild(el);
        
      4. I added a log message into the last js file which will be dynamically loaded and in the console window, I saw this message which means the js files are all loaded.
        But then after that, the app just freezes forever.

      Attachments

        Activity

          People

            Unassigned Unassigned
            originrobot Raven Zuo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: