Browser with download facilities
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Browser with download facilities
This topic is now obsolete but can be used to investigate the development.
It is about an extension of Dav's browser viewtopic.php?f=20&t=854.
New information is now avaialble in viewtopic.php?f=20&t=2029&p=12290#p12290
It is about an extension of Dav's browser viewtopic.php?f=20&t=854.
New information is now avaialble in viewtopic.php?f=20&t=2029&p=12290#p12290
Last edited by Dutchman on Thu Jan 19, 2023 3:24 pm, edited 25 times in total.
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: Browser with download facilities
Wow! You are riding the lightning. What a great set of tools for circumventing foolishness!
I must set aside my plans for the afternoon and start downloading.
I must set aside my plans for the afternoon and start downloading.
The only thing that gets me down is gravity...
- Dav
- Posts: 279
- Joined: Tue Dec 30, 2014 5:12 pm
- My devices: iPad Mini, iPod Touch.
- Location: North Carolina, USA
- Contact:
Re: Browser with download facilities
This sounds like a great upgrade, Dutchman! I'll be downloading it and give it a go!
- Dav
- Dav
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: Browser with download facilities
My next step would be to connect to my computer.
I found a possible solution at https://www.w3schools.com/Jsref/tryit.a ... load_files
The script is intended to select a file from active servers.
I copied the script to "connect.HTML" and activated it with "Connect.sb"
I can not attach "connect.HTML", it is not accepted for "Place inline", so I copied it in the following code section:
The program "Connect.sb" is attached, remove the extension ".txt" before usage.
After program start on my iPad a browser-page was active with the following content after touching the button:
Apart from the camera and the Photo Library of my iPad, it also shows the Dropbox and FileBrowser apps which obviously are also considered as server to which might be connected. Before usage however some switches had to be set which I discovered after touching "Meer…" (Eng: "More…")
After that, I could access my "Smart Basic"-folder on Dropbox:
and SURPRISE: into my Mac:
I expect that the program "Connect.sb" can form the basis for an elegant alternative for the current Dropbox access facility.
I added the two files to the "File transfer" folder on Dropbox.
I found a possible solution at https://www.w3schools.com/Jsref/tryit.a ... load_files
The script is intended to select a file from active servers.
I copied the script to "connect.HTML" and activated it with "Connect.sb"
I can not attach "connect.HTML", it is not accepted for "Place inline", so I copied it in the following code section:
Code: Select all
<html>
<body onload="myFunction()">
<input type="file" id="myFile" multiple size="50" onchange="myFunction()">
<p id="demo"></p>
<script>
function myFunction(){
var x = document.getElementById("myFile");
var txt = "";
if ('files' in x) {
if (x.files.length == 0) {
txt = "Select one or more files.";
} else {
for (var i = 0; i < x.files.length; i++) {
txt += "<br><strong>" + (i+1) + ". file</strong><br>";
var file = x.files[i];
if ('name' in file) {
txt += "name: " + file.name + "<br>";
}
if ('size' in file) {
txt += "size: " + file.size + " bytes <br>";
}
}
}
}
else {
if (x.value == "") {
txt += "Select one or more files.";
} else {
txt += "The files property is not supported by your browser!";
txt += "<br>The path of the selected file: " + x.value; // If the browser does not support the files property, it will return the path of the selected file instead.
}
}
document.getElementById("demo").innerHTML = txt;
}
</script>
<p><strong>Tip:</strong> Use the Control or the Shift key to select multiple files.</p>
</body>
</html>
I added the two files to the "File transfer" folder on Dropbox.
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: Browser with download facilities
I made in Apple's "Human Interface Guidelines" the following screenshot:
https://developer.apple.com/ios/human-i ... -handling/
So it should be allowed for Smart Basic to share files with e.g. the Dropbox app, FileBrowser or other apps.
See So it should be allowed for Smart Basic to share files with e.g. the Dropbox app, FileBrowser or other apps.
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: Browser with download facilities
I added a 'serial' version of the pdf-document "HTML document interface"
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Browser with download facilities
I stopped arguing with Apple regarding this topic. They do not understand their own guidelines.Dutchman wrote: ↑Thu Sep 14, 2017 1:47 pmI made in Apple's "Human Interface Guidelines" the following screenshot:
Screenshot from Apple's Human Interface Guidelines.png
See https://developer.apple.com/ios/human-i ... -handling/
So it should be allowed for Smart Basic to share files with e.g. the Dropbox app, FileBrowser or other apps.
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: Browser with download facilities
Several changes have been made.
As indicated in the updated code:
• Furthermore I have modified all subroutines to functions in order to reduce the number of global variables. Most of the variables are now local, which simplifies debugging.
• The height of the topbar is now a variable, so that it can be scaled with the device, as the "preference."-file on iPhone can be different from that on iPad.
• The number of dump-files can grow very fast. Therefore I added a warning, during start-up, if the number of dump-files exceeds a certain threshold.
• It happened to me that I was wondering why a page did not load or refresh, until I discovered that the device in the meantime became offline. Therefore I added a warning in case of such a condition.
• The command-line which calls the launcher has been commented so that it will not cause errors in case it is not implemented.
The screenshots and files have been updated.
Please post suggestions for improvements.
As indicated in the updated code:
• The major change for the user is that the user-settings are moved to a separate file: "preferences." so that they are automatically transferred to new versions. In order to prevent "preferences." from overwriting, you could rename it to e.g. "preferences.name" and change the include-statement in the top of the program accordingly, form {preferences.} to {preferences.name}. Thus you need only to change that statement if an update is installed.'Changes since first post on http://bit.ly/2wZf2yB
'20170915
' Introduction info moved to "browser initial.info"
' Added warning for overload in Downloads
' Status of buttons moved from global to 'function' "But"
' All subroutines changed to functions
' Height and font of infobar made variable
' Empty battery-part coloured red
' User preferences separated in file "preferences."
' Warning added for attempt to access www offline
• Furthermore I have modified all subroutines to functions in order to reduce the number of global variables. Most of the variables are now local, which simplifies debugging.
• The height of the topbar is now a variable, so that it can be scaled with the device, as the "preference."-file on iPhone can be different from that on iPad.
• The number of dump-files can grow very fast. Therefore I added a warning, during start-up, if the number of dump-files exceeds a certain threshold.
• It happened to me that I was wondering why a page did not load or refresh, until I discovered that the device in the meantime became offline. Therefore I added a warning in case of such a condition.
• The command-line which calls the launcher has been commented so that it will not cause errors in case it is not implemented.
The screenshots and files have been updated.
Please post suggestions for improvements.
- Dav
- Posts: 279
- Joined: Tue Dec 30, 2014 5:12 pm
- My devices: iPad Mini, iPod Touch.
- Location: North Carolina, USA
- Contact:
Re: Browser with download facilities
Great work, Dutchman. Although I haven't tested it yet, it looks fantastic and I hopefully will get to play around with it this weekend.
Here's something you may be interested in (or maybe not since you are already can download whole pages it looks like). I was going to add this method to my browser because rbytes had asked about an easy way of saving an image on the page.
This example code shows how you can get just a list of images contained in a webpage, and select one to download. I was going to put the image urls in a list and allow the user to select one to download from a list pop up box (like the bookmarks pop up menu). The code below lists all the images on my website main page and downloads bignews.gif to your device if you wish.
- Dav
Here's something you may be interested in (or maybe not since you are already can download whole pages it looks like). I was going to add this method to my browser because rbytes had asked about an easy way of saving an image on the page.
This example code shows how you can get just a list of images contained in a webpage, and select one to download. I was going to put the image urls in a list and allow the user to select one to download from a list pop up box (like the bookmarks pop up menu). The code below lists all the images on my website main page and downloads bignews.gif to your device if you wish.
- Dav
Code: Select all
'GrabPageImage.txt
'shows how to list every image contained in a web page,
'and save one you choose to your device.
'by Dav. Note: uses image from my web page as example.
option base 1
'load my website main page for demo...
url$="http://www.qbasicnews.com/dav/"
browser "1" url url$ at 0,0 size 0,0
print "Loading "; url$
print
'get number of images in the document
images=browser_text$("1", "document.images.length")
'if there are any, list them...
if images >0 then
print "This page has "&images&" images"
print
'show them all...
for t = 0 to images-1
print t, browser_text$("1", "document.images["&t&"].src")
next t
print
end if
'let's grab one to use...should be bignews.gif
a$=browser_text$("1", "document.images["&2&"].src")
print "Let's use this image for testing..."
print "Image: ";a$
print
'strip out url stuff, just get filename...
'read the url backwards, stopping at a /
a2$=""
for t=len(a$) to 1 step -1
b$=mid$(a$,t,1)
if b$="/" then break
a2$=b$&a2$
next t
'new filename to use when saving to device...
print "Filename for saving: "; a2$
end '<--- comment this out to save file
'here's how you can save the image to device...
print
print "Saving ";a2$
http a$ getdim m 'use the full url here.
file a2$ writedim m 'save just the filename.
'now, a bignews.gif should be saved in the folder...
- Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Re: Browser with download facilities
Great idea! I will add an image button to the browser, for downloading images