Getting Browser Widget to Read Local Assets

hh hh at hyperhh.de
Tue Jan 15 14:06:36 EST 2019


BR,

assuming you don't have a local server running:

It is an essential difference whether you set the htmltext or
set the URL of the widget.

If the image is called in the htmltext then there is no way but
using a dataURL (=inline image), no matter if it is an img tag or
called in the style tag. But that works always.

If you save the same htmltext to a html file then the image from
a local path that is *relative* to that file is loaded.

There are very few cases where *absolute* file:// - syntax works
and there will be increasing less cases.

If the image becomes "tinted" (by acting on it's data), then you
will need a local server running that calls that html file.

If you use a video file instead of an image (or a webcam) then
you will need a https - connection to your local server. This is
very hard to install except you use a solution like the commercial
MAMP Pro (assuming you are on Mac).

Also look at the following:

> BR wrote:
> 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]

You have to fill the placeholder <b64Data>, for instance this way:
...(replace line ** in mouseUp):
set the htmltext of  widget "browser" to merge(fld "html")
...
and then in the html:
background-image: url('data:image/jpg;base64,[[b64Data]]')



More information about the use-livecode mailing list