Getting Browser Widget to Read Local Assets
hh at hyperhh.de
Fri Jan 11 15:58:20 CET 2019
Field and button names below relate to my example stack.
To use a local file (= NOT from a local or remote server) you have
to load the image from a stack property or url("binfile:"...) and
add it inline (base64 encoded):
Step 1: imageVariable = stack property or url("binfile:"...)
Step 2: put base64Encode(imageVariable) into b64Data
Step 3: replace linefeed with empty in b64Data --> IMPORTANT!!
Step 4: write in fld "HTML" of my example stack
**** The width x height of the image to load and the width x height
of the loader in fld "HTML" should roughly coincide:
You don't really want to load a 1200x800 image as background
into a 192x128 rotating DOM object?
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>).
And if the image is large, then you could use in the script of
widget "Browser" of the example stack:
delete widget "loader" --> instead of hide widget "loader"
More information about the use-livecode