Download through webviewer

Hello, i made a website ( ) and i was trying to turn it into a super simple app for android, i managed to get everything to work correctly, including the input and account system, but how can i make the site download a file?, i use this inside the website to download the file:

function downloadJSON(inArray, fileName) {
var json = JSON.stringify(inArray)

//Convert JSON string to BLOB.
json = [json]
var blob1 = new Blob(json, {
    type: "text/plain;charset=utf-8"

//Check the Browser.
let isIE = false || !!document.documentMode
if(isIE) {
    window.navigator.msSaveBlob(blob1, fileName)
    let url = window.URL || window.webkitURL
    link = url.createObjectURL(blob1)
    let a = document.createElement("a") = fileName
    a.href = link

it does work on the website (opened trough a browser) but it doesnt work when the website is inside the webviewer in the app, is there a way i can fix it? (the file is generated locally, it’s not in a server)

EDIT: i changed download method to this one:

var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(inArray));
var dlAnchorElem = document.createElement("a")
dlAnchorElem.setAttribute("href",     dataStr     );
dlAnchorElem.setAttribute("download", fileName+".txt");; 

This gives me the URL encoded json, how can i convert that back to a json and download the text as a file.txt?

Your web app is mind blowing…

thanks a lot ^-^

What language did you use to code that.

simple javascript/html/css , a bit of jquery here and there to add animations
for the backend i used node.js

Yay i made it! after changing the download method in the website i used this to create a text file and read the URI for it’s value.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.