Trigger a javascript function using the browser widget

paolo mazza mazzapaoloitaly at gmail.com
Sat Jun 18 06:29:32 EDT 2016


Thank you Hausser,
reading the messages of the list I figured out how to trigger a
javscript function using the Browser widget.
I think there are some lacks in the LC 8 documentation.

However it is quite trivial.
As an example, just use command
 do "liveCode.myJSHandler(add(1,2))" in widget 1
to trigger the javascript function add, provided in the card script
you have  inserted these handlers:

on Opencard
  set the javascriptHandlers of widget "myBrowser" to "myJSHandler"
end Opencard

on myJSHandler pMessage, pValue
   answer pMessage && pValue
end myJSHandler

All the best,
Paolo Mazza



On Fri, Jun 17, 2016 at 10:38 AM, Jacques Hausser
<jacques.hausser at unil.ch> wrote:
> It’s not obvious, but see to the recent thread “browser widget again” (sorry, no time for a better answer just yet)
>
>> Le 17 juin 2016 à 10:31, paolo mazza <paolo.mazza at neol.it> a écrit :
>>
>> Hi all,
>> how can I trigger a javascript function of a web page loaded in the
>> browser widget  using a LC command?
>> I can not find this in the browser widget documentation.
>> All the best,
>> Paolo Mazza
>>
>> _______________________________________________
>> 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
>
> ******************************************
> Prof. Jacques Hausser
> Department of Ecology and Evolution
> Biophore / Sorge
> University of Lausanne
> CH 1015 Lausanne
> please use my private address:
> 6 route de Burtigny
> CH-1269 Bassins
> tel:    ++ 41 22 366 19 40
> mobile: ++ 41 79 757 05 24
> E-Mail: jacques.hausser at unil.ch
> *******************************************
>
> _______________________________________________
> 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