Getting Browser Widget to Read Local Assets

Sannyasin Brahmanathaswami brahma at hindu.org
Tue Jan 15 09:41:57 EST 2019


HH wrote:

    You could also do step 1 to 4 once and put compress(fld "HTML")
    into a <stack property>, then set later on in btn "LoadURL" the
    htmltext to decompress(<stack property>).

BR: Thanks for your attentive in response to my query. I am keeping you posts in a folder entitled "Browser Widget Manual" 

I tried this but it did not work, I think I missing a piece of the puzzle 

====
on mouseup
   put the uAlphabetA of this stack  into imageVariable
   put the uAlphabetA of this stack  into img "alphabet"  
       # just checking it’s artist's versions an "A" at 122px H,122px W
   put base64Encode(imageVariable) into b64Data
   replace linefeed with empty in b64Data
   set the htmltext of  widget "browser" to the fld "html"
end mouseup

This image there. It appears into stack and also in the variables....

we have in the html

[snip] background-image: url('data:image/jpg;base64,<b64Data>') [snip]

??

---------------

It this coding to a "stack local " to base64 only required if you want to use it as a background image? What about a 

<img src="assets/img/some.jpg" />

A couple of months ago I imported an entire HTML5 app folder done in React, to a local folder, let's call it 

/workout
      Index.html
            assets
  workout.livecode # with a browser widget

 it showed images in its asset folder.

But today I cannot getting img src working with 

/MyTest
    browserTesting.livecode
         /alphabet
                A_122x122_thm.jpg
   
<body class="bodyStyle">
<div class="textNotice"> 
<img src="alphabet/A_122x122_thm.jpg" /> 
        # the above appears as an image, but with a ? mark in it.
<h2> Loading.<br /> Please wait...</h2>
<h3>If the web site is slow or if you have a bad connection - cancel by going <i>Home</i></h3>
</div>
<div class="loader">
</div>
</body>

BR






More information about the use-livecode mailing list