Javascript handler issue on Android

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Armenhui
Posts: 71
Joined: Fri Oct 16, 2015 12:44 pm

Javascript handler issue on Android

Post by Armenhui » Tue May 10, 2016 7:17 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Javascript handler issue on Android

Post by FourthWorld » Tue May 10, 2016 7:35 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Armenhui
Posts: 71
Joined: Fri Oct 16, 2015 12:44 pm

Re: Javascript handler issue on Android

Post by Armenhui » Tue May 10, 2016 8:51 pm

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>

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Javascript handler issue on Android

Post by FourthWorld » Thu May 12, 2016 6:40 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply