"get in widget"?? How can I get a value out of a browser widget into LiveCode?
Ben Rubinstein
benr_mc at cogapp.com
Tue Apr 18 12:08:10 EDT 2023
I've found a solution. For the benefit of others (and myself, because I'll
have forgotten this next time I want it), this can be done using "the
javascriptHandlers".
So you can set up a handler to be called from the browser:
set the javascriptHandlers of widget "Browser" to "myJSHandler"
... and then have javascript pass the expression to that handler:
do "liveCode.myJSHandler(document.title);" in widget "browser"
On 17/04/2023 16:17, Ben Rubinstein via use-livecode wrote:
> Thanks Klaus, I tried both of those!
>
> So for example I can execute
> do "alert(document.title)" in widget "browser"
>
> and see the expected string in an alert box. But
> do "document.title" in widget "browser"; put it
>
> or
> do "document.title" in widget "browser"; put the result
>
> just put empty.
>
> Any other ideas? I don't know whether I need to do something different in the
> livecode end (probably) or in the javascript end.
>
> TIA,
>
> Ben
>
>
> On 17/04/2023 16:11, Klaus major-k via use-livecode wrote:
>> Hi Ben,
>>
>>> Am 17.04.2023 um 16:37 schrieb Ben Rubinstein via use-livecode
>>> <use-livecode at lists.runrev.com>:
>>>
>>> Thanks to this list, I know about "do in widget" that can cause some
>>> javascript to be evaluated in the current page in the browser widget. Which
>>> is great.
>>>
>>> But how do I get (into LiveCode) the result of a javascript expression?
>>
>> if in doubt try either -> IT or -> the result :-)
>>
>>> TIA,
>>>
>>> Ben
>>
>> Best
>>
>> Klaus
>>
>> --
>> Klaus Major
>> https://www.major-k.de
>> https://www.major-k.de/bass
>> klaus at major-k.de
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list