I am trying to make a Html Editor and I have put a download button in my webpage which downloads the code as a HTML file.
This is able to download the HTML file in any browser but is not working in the app and showing the following error:
I am using the following way to download a file from a WebViewer as stated by
this is a basic guide to download the any file with the exact filename from download URL using On Download Start block from web viewer component.
just do the exact block arrangement which is shown below.
components used -
I hope this will help some users who wants to save file with the file name given in the download url.
i also updated the T-Browser (Open Source Version) with this download logic. if you want you can download the aia file from original post give…
Any help would be highly appreciated.
Look at the screen with the error says: Can only download HTTP/HTTPS url’s.
What is the address of the file you want to download ?
Check if you forgot http:// or https:// in the link
I called snackbar to show the url and here is what I found:
In this, I used FileSaver.js library
I think the problem is blob files
Read this article
Hmm… I came accross that while browsing. But that couldn’t solve my issue either
You see this in my link ???
That was when I was using FileSaver.js library. I tried saving the file by my
other method and here is what I got as url:
( without any library )
I think that is the content of the html file and not the html file
It is working in any browser.
While downloading any file the url must start with HTTP or HTTPS otherwise it will so this error. there no other option.
data:html/plain;charset=utf-8… the reult into html file, open it and look what happens
This is only what I want to achieve.
If can show the content into snackbar you can save the content into html file with file component !!!
How can I save a text into an HTML file ??
Where does the File component saves the file ??
Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard. For example writing to /myFile.txt will write the file to /sdcard/myFile.txt. If the filename does not start with a slash, it will be written in the programs private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI Companion where these files are written to /sdcard/AppInventor/data to facilitate debugging. Note that this block will overwrite a file if it already exists If you want to add content to a file use the append block.
Check if you need add permision for that !!
I checked the docs to see that.
Does it means that the file is not accessible to the user ??
For other programs or app’s !!! only you app can access to the file