Subject: Re: Local File in Browser Widget on Android - Fail
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.
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."
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?