Hello,
Sorry for the question. Maybe it has been already raised, but I cannot find in the forum an answer.
=> Is there a way to exchange data between HTML/JS with Livecode through webkit.
I need to :
1/ Launch a google map and set some flag on the map. The user should be able to filter the flag. Livecode should manage a database with information set by the user and sent to the map location and customized flags.
2/ Launch a processingjs applet and exchange information about the User Interaction.
3/ Get jSon data : with jquery it is very easy to recover these. I thought I could recover json data with jquery and pass it to livecode to process the data into a datagrid.
It seems it is impossible to let livecode communicate with Javascript. Did someone find a workaround ?
Regards,
Frédéric
Exchange data with HTML in web browser
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Exchange data with HTML in web browser
I have very limited exposure to HTML and JS.
However what I have been doing is saving the HTML/ JS source code in a text file labeled map.html and prior to loading map.html in the IOS browser I move map.html from the IOS engine folder to the IOS documents folder where it can be edited and then alter desirable lines of HTML/JS in the map.html file based on user input derived from live code. by simply replacing the entire line of code such as... loading the current location's lat long into a var called tWhereYouAt and then altering the google map by inserting this line of code
put " var latLng = new google.maps.LatLng(" & tWhereYouAt & ");" into line 142 of theData
I have also been experimenting around with plotting points on the map from data contained in a google fusion database which is free and offers geocoding and reverse geo coding between addresses and lat,long.
If you come across a cool slider that fades a .kml overlay in and out that is draped over a google map let me know or if you write some code that query's a fusion database directly from live code I would be interested to see that. I hope this helps some what. I prefer to work from within live code whenever possible so working around my limitations in JS and HTML.
Dave
PS Google Map API V3 is pretty informative with lots of examples.
However what I have been doing is saving the HTML/ JS source code in a text file labeled map.html and prior to loading map.html in the IOS browser I move map.html from the IOS engine folder to the IOS documents folder where it can be edited and then alter desirable lines of HTML/JS in the map.html file based on user input derived from live code. by simply replacing the entire line of code such as... loading the current location's lat long into a var called tWhereYouAt and then altering the google map by inserting this line of code
put " var latLng = new google.maps.LatLng(" & tWhereYouAt & ");" into line 142 of theData
I have also been experimenting around with plotting points on the map from data contained in a google fusion database which is free and offers geocoding and reverse geo coding between addresses and lat,long.
If you come across a cool slider that fades a .kml overlay in and out that is draped over a google map let me know or if you write some code that query's a fusion database directly from live code I would be interested to see that. I hope this helps some what. I prefer to work from within live code whenever possible so working around my limitations in JS and HTML.
Dave
PS Google Map API V3 is pretty informative with lots of examples.
Re: Exchange data with HTML in web browser
Thanks a lot.
I am reading the google map v3 api which is unbelievable ! The possibilities are huge.
The way you do is rewriting the html page before opening which is clever but you cannot exchange data in real time with JS in IOS browser. Am I wrong ?
I am reading the google map v3 api which is unbelievable ! The possibilities are huge.
The way you do is rewriting the html page before opening which is clever but you cannot exchange data in real time with JS in IOS browser. Am I wrong ?
Re: Exchange data with HTML in web browser
you asked if
".. you cannot exchange data in real time with JS in IOS browser.."
I did not see an answer to that - anyone?
I CAN do this successfully on a mac (e.g. filling in a form field) using
put "document.forms['input0'].user.value = 'Bob';alert(document.forms['input0'].user.value);" into theScript
get revBrowserExecuteScript(tBrowserId, theScript)
This writes "Bob" to the form field, then issues an alert reading from the form field
but the iOs equivalent
iphoneControlDo tBrowserId, "execute", theScript
does NOT work
I can't even read simple information, e.g. alert(document.title) in iOS
in iOS, a simple javascript like
alert("This is a debugging message");
works OK, but the key seems to be that this script is NOT interacting with the document in real time
I guess this could be a sandboxing thing on iOS, but certainly is NOT clear in the (minimal) documentation of iphoneControlDo tBrowserId, "execute", theScript
My Main objective is to fill in an HTML form in an iOS browser, using Javascript - seems that this may be impossible
any thoughts would be appreciated
I guess a last resort could be to get the html of the page, insert the required value into the form field html offscreen and then post the modified form data..
I can't see this working for all page (e.g. JS validation issues etc), but I will gee it a try
".. you cannot exchange data in real time with JS in IOS browser.."
I did not see an answer to that - anyone?
I CAN do this successfully on a mac (e.g. filling in a form field) using
put "document.forms['input0'].user.value = 'Bob';alert(document.forms['input0'].user.value);" into theScript
get revBrowserExecuteScript(tBrowserId, theScript)
This writes "Bob" to the form field, then issues an alert reading from the form field
but the iOs equivalent
iphoneControlDo tBrowserId, "execute", theScript
does NOT work
I can't even read simple information, e.g. alert(document.title) in iOS
in iOS, a simple javascript like
alert("This is a debugging message");
works OK, but the key seems to be that this script is NOT interacting with the document in real time
I guess this could be a sandboxing thing on iOS, but certainly is NOT clear in the (minimal) documentation of iphoneControlDo tBrowserId, "execute", theScript
My Main objective is to fill in an HTML form in an iOS browser, using Javascript - seems that this may be impossible
any thoughts would be appreciated
I guess a last resort could be to get the html of the page, insert the required value into the form field html offscreen and then post the modified form data..
I can't see this working for all page (e.g. JS validation issues etc), but I will gee it a try