1 Reply Latest reply: Jul 1, 2016 11:34 AM by Ashvin Ramiah RSS

    Extension Code to write in a text file

    Ashvin Ramiah

      Hi  ,

      I am trying to write an extension to save in a file.

      The same is working on chome html sample.

      But but not working on SENSE....any idea

       

       

      function saveTextAsFile()

       

      {

          var textToSave = document.getElementById("inputTextToSave").value;

          var textToSaveAsBlob = new Blob([textToSave], {type:"text/plain"});

          var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);

          var fileNameToSaveAs = document.getElementById("inputFileNameToSaveAs").value;

       

          var downloadLink = document.createElement("a");

          downloadLink.download = fileNameToSaveAs;

          downloadLink.innerHTML = "Download File";

          downloadLink.href = textToSaveAsURL;

          downloadLink.onclick = destroyClickedElement; // assume this method is available

          downloadLink.style.display = "none";

          document.body.appendChild(downloadLink);

       

          downloadLink.click();

      }