browser widget use in livecode server (restrictions?)
Posted: Fri Feb 14, 2020 12:35 am
I have a functioning stack that does what I need to do, running fine on LC 9 on Mac OS X with my Indy license. For now, it simply creates a browser widget, opens a website in it and extracts the value of a specific field.
on myJSHandler Message
answer "myJSHandler:" && Message
end myJSHandler
create widget "myBrowser" as "com(dot)livecode(dot)widget(dot)browser"
set the javascriptHandlers of widget "myBrowser" to "myJSHandler"
set the url of widget "myBrowser" to "someserver address"
put "var myLoc;"&return&"myLoc=$('#aboutLandscape h2').html();"&return&"liveCode(dot)myJSHandler(myLoc);" into tJS
do tJS in widget "myBrowser"
This opens the html page and sucks out the value of the specified id (I was ecstatic to discover that jQuery on the site was usable). This code fails silently when run in within index(dot)lc page using LiveCodeIndyServer-9_5_1-Linux-x86_64. Livecode server is properly installed and functional. "Fail" means that the callback myJSHandler is never hit, so no extracted data is available. Since there's apparently no other way get scrape content from a browser widget other than using "do" with the corresponding liveCode(dot)callback (see above) I use "put" instead of "answer" in the myJSHandler in the case of Livecode Server (since answer, ask, etc functionality isn't possible in Livecode Server). Am I foolish to believe that I should be able to use a browser widget on Livecode Server .lc pages? I have lots of other jQuery goodies that I expected to hook up once I get this protocol to work, the fact that it works so well on the Mac IDE makes me suspicious that it's not expected to work on Livecode Server, is that true?
on myJSHandler Message
answer "myJSHandler:" && Message
end myJSHandler
create widget "myBrowser" as "com(dot)livecode(dot)widget(dot)browser"
set the javascriptHandlers of widget "myBrowser" to "myJSHandler"
set the url of widget "myBrowser" to "someserver address"
put "var myLoc;"&return&"myLoc=$('#aboutLandscape h2').html();"&return&"liveCode(dot)myJSHandler(myLoc);" into tJS
do tJS in widget "myBrowser"
This opens the html page and sucks out the value of the specified id (I was ecstatic to discover that jQuery on the site was usable). This code fails silently when run in within index(dot)lc page using LiveCodeIndyServer-9_5_1-Linux-x86_64. Livecode server is properly installed and functional. "Fail" means that the callback myJSHandler is never hit, so no extracted data is available. Since there's apparently no other way get scrape content from a browser widget other than using "do" with the corresponding liveCode(dot)callback (see above) I use "put" instead of "answer" in the myJSHandler in the case of Livecode Server (since answer, ask, etc functionality isn't possible in Livecode Server). Am I foolish to believe that I should be able to use a browser widget on Livecode Server .lc pages? I have lots of other jQuery goodies that I expected to hook up once I get this protocol to work, the fact that it works so well on the Mac IDE makes me suspicious that it's not expected to work on Livecode Server, is that true?