Downloads from Website to Mobile

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
JereMiami
Posts: 11
Joined: Mon Nov 03, 2014 12:17 am

Downloads from Website to Mobile

Post by JereMiami » Mon Jun 29, 2020 3:32 pm

I am wondering if there is a way to allow a mobile device to download a .txt file from a website like a desktop web browser does.

1) The website automatically transfers a .txt file to a desktop web browser upon executing javascript.
2) The mobile device, to my knowledge, does not download the .txt file when executing javascript using mobileControlDo "execute."
3) The mobile browser is a browser widget created by mobileControlCreate.

Is there any way for the mobile's web browser widget to download this .txt file?

Klaus
Posts: 11829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Downloads from Website to Mobile

Post by Klaus » Tue Jun 30, 2020 2:23 pm

Hi JereMiami,

some questions:
Does the TXT file have a fixed URL?
If yes, you could simply download it "manually (with a script)" with "load url..." or "put url..."
We have write permission in the users Documents folder, so you should load it to
-> specialfolderpath("documents") & "/name_of_your_file.txt"
2) The mobile device, to my knowledge, does not download the .txt file when executing javascript using mobileControlDo "execute."
No, and I guess on the desktop there will be an alert before downloading the file, right?
Otherwise this would be a VERY HIGH security hole! :-)
3) The mobile browser is a browser widget created by mobileControlCreate.
There is a big difference between "the browser widget" and a native browser instance created with "mobilecreate...", like "mobilecontroldo..." does not work in a WIDGET!
So what are you actually using here?

Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5406
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Downloads from Website to Mobile

Post by jacque » Tue Jun 30, 2020 5:30 pm

My mobile apps download text files without any problem. There is no warning and the download is very fast. I've never done it from within a browser though, it's done as Klaus suggests by scripting the download in LC, saving the file to the documents folder, and then setting the html of the native browser control to the content of the file.

Getting the file from the server is easy, just use the "put url" syntax:

Code: Select all

put url <url to server file> into url <path to documents folder>
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”