title: javascript : create and save files to device
body: <p>this code is working fine when I open it in browser. but when I create application it's showing nothing..!!
  please help. how do I create application that saving files</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;
    &lt;script src="text/javascript"&gt;
    // Function to download data to a file
    function download(data, filename, type) {
      var file = new Blob([data], {type: type});
      if (window.navigator.msSaveOrOpenBlob) {// IE10+
        window.navigator.msSaveOrOpenBlob(file, filename);
      }
      else { // Others
        var a = document.createElement("a"),
            url = URL.createObjectURL(file);
        a.href = url;
        a.download = filename;
        document.body.appendChild(a);
        a.click();
        setTimeout(function() {
          document.body.removeChild(a);
          window.URL.revokeObjectURL(url);  
        }, 0); 
      }
    }
    &lt;/script&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>