Subject: Re: Local File in Browser Widget on Android - Fail

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Subject: Re: Local File in Browser Widget on Android - Fail

J. Landman Gay via use-livecode
Sannyasin,

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!

-Dan

 

On 8/11/17, 2:33 AM, "use-livecode on behalf of [hidden email]" <[hidden email] on behalf of [hidden email]> 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
   
    file:/somepath/somefile.html
   
    works
   
    file://somepath/somefile.html  
   
    doesn't  
   
    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
   
    function path_Assets
        return specialFolderPath("documents") & "/assets/"
    end path_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" <[hidden email] on behalf of [hidden email]> 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?
       
        -Dan

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...