debugging javascript in html5

Bernard Devlin bdrunrev at
Fri Mar 18 07:19:28 EDT 2022

Here's a peculiarity I haven't seen mentioned before.  I am trying to test
the viability of the idea of a function to call back to LC and provide
debugging info.

Assume you create a LC function lclog(pmsg,pval) and you put a breakpoint
in the IDE inside that function body.  Set the htmltext of a browser widget
to the code below, set the javascriptHandlers of the browser to contain the
word: lclog . Your browser widget will have a button 'clickme'.
1) On clicking that button the JS alerts ALL trigger first.
2) After they have fired the first call to lclog() runs, and the second
call to lclog() never runs.


function lcxhr(method, url) {

alert('lcxhr called');

var json = JSON.stringify({ name: "John", surname: "Smith"});

liveCode.lclog('json created', json);

alert('you see this alert before the above call to lclog()');

liveCode.lclog('exit js function','');


</head><body><input id="clickMe" type="button" value="clickme"
onclick="lcxhr('','');" /></body></html>

In case that html gets mangled by the uselist software, here's the above
html base64encoded:









So we can't rely on the timing of anything returned to a javascripHandler.
Moreover, once a javascriptHandler has fired there can't be anything else
that runs.  Quite a limitation IMO.




More information about the use-livecode mailing list