Page 1 of 1

Javascript handler issue on Android

Posted: Tue May 10, 2016 7:17 pm
by Armenhui
Hi all,

Any one know how can call LiveCode command from browser with javascript handler ?

I used LiveCode 8.0.0 stable version and browser widget, to do that we defined a handler to respond to javascript calls. Then we set javascript handler of the browser widget to our handler. And created a separate web page where the browser calls a LiveCode function.

It works good on Windows and Mac. As for IOS, handler works but the result pops-up with different frequency.

And the handler didn't work on Android.

Any help will be appreciated.

Thanks.

Re: Javascript handler issue on Android

Posted: Tue May 10, 2016 7:35 pm
by FourthWorld
Hello Armenhui -

Are you using the CEF browser specifically? If so, please post the example code that works for other platforms and we'll see what we can do.

BTW: installed Playland Armenia yesterday - good fun, your team did a great job.

Re: Javascript handler issue on Android

Posted: Tue May 10, 2016 8:51 pm
by Armenhui
Thank you for good words.


No We do not use CEF browser, We use LiveCode 8.0.0 Browse Widget.

This is card script code

Code: Select all

on opencard
   
   -- Set  URL for Mybrowser widget
   set the URL of widget "MyBrowser" to "http://lc13754376.on-rev.com/testBrowser" 
   
   -- Set up the browser javascript handler list
   -- This code goes in a suitable setup handler
   set the javascriptHandlers of widget "MyBrowser" to "myJSHandler" 
   
end opencard


-- Define a handler to respond to javascript calls.
on myJSHandler pMessage, pValue
   
   -- Do appropriate actions here.
   answer"hello world" 
   
end myJSHandler


This is html code where we call LiveCode myJSHandler handler

Code: Select all

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<input type="button" value="click" onclick="liveCode.myJSHandler('myMessage',12345)" style="width:300px;height:70px;">

</body>
</html>

Re: Javascript handler issue on Android

Posted: Thu May 12, 2016 6:40 pm
by FourthWorld
Thanks, Armenhui. I discussed this with one of the lead engineers this morning, and he pointed me to a bug report which turns out to be yours:
http://quality.livecode.com/show_bug.cgi?id=17620

Hopefully the workaround Panos noted there will work out well for what you need. If not let us know and we'll see if we can come up with a solution for you.