Subject: Re: Local File in Browser Widget on Android - Fail
dan at clearvisiontech.com
Fri Aug 11 10:44:02 EDT 2017
Thank you for the reply! I have discovered that it’s not the local path the is the issue. If I do this, I see “123” in the browser:
put “123” into url ("file:" & specialFolderPath("documents") & "/map.html")
set the url of widget "Browser1" to ("file:" & specialFolderPath("documents") & "/map.html")
However, the html document I am trying to load references images that were included in the app. These images are here: specialFolderPath("engine"). Note that a “there is a file” test proves the existence of the file.
So, here’s what I do, I load the html template from a custom property. In my html document, I have this:
historicalOverlay = new google.maps.GroundOverlay('<LOCALINCLUDEDPATH>/MapFinal.png',imageBounds);
I then insert the local path:
replace "<LOCALINCLUDEDPATH>" with specialFolderPath("engine") in mapFile
Then I save the file to disk and load it into the browser widget. On my mac and iOS it works famously. On Android, I just get a broken image icon.
Do I have to alter the local image path somehow?
Again, thank you for the response and assistance!
On 8/11/17, 2:33 AM, "use-livecode on behalf of use-livecode-request at lists.runrev.com" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode-request at lists.runrev.com> wrote:
make sure your slashes are all correct. on iOS and desktop are forgiving with double// in URLs; but android is not.. .this bit me many times
So If you have path setters here and there, one needs to follow some convention, either leave folder string *always* with no closing slash and all appended url strings begin with a slash.. I started that way but this was always confusing to me because on web / means "from DOCROOT" so slowly I am refactoring all these to
return specialFolderPath("documents") & "/assets/"
then in any module we use
play sound (path_Assets() & "bells-whistles/ding.mp3") because this is "relative" # very subjective..
So what started failing on Android -- really hard to debug!
where instances of
play sound (path_Assets() & "/bells-whistles/ding.mp3")
because these would work on Mac desktop and only fail on Android so you are beating your head "what is wrong."
On 8/10/17, 1:28 PM, "use-livecode on behalf of Dan Friedman via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:
I?m having a problem loading a local file on Android in the Browser Widget in LC 8.1.5. I am experiencing what is described in bug 19036. But, bug 19036?s status is ?Resolved? in version 8.0.0. So, is something else up? Anyone have any insight?
More information about the Use-livecode