1 Reply Latest reply on Mar 4, 2018 2:37 PM by jcesarmobile_

    Code to create and save file in javascript fails in phonegap

    nospamn87015891 Level 1

      I've used the following javascript code to create and save a file in the downloads folder. This works fine in Chrome, but the same code fails when compiled to an Android app via phonegap? How do I get this to work?


      filename ='info.xml';

      XMLtext = 'blah';



      //Create download file

      var element = document.createElement('a');

      element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(XMLtext));

      element.setAttribute('download', filename);

      element.style.display = 'none';