About webBrowserComponent


#1

Hi, my name is Cesar.
I’m trying to make an app that uses a webBrowserComponent to display a google map.
I miss an easy way to comunicate my juce controls with the webpage.
Now, I’m making (in local FS) a web page for each (lat,long) pair that I wish to show in the map and then load the content doing a refresh to the component.
Do you know a more elegant way to do it?

Thanks in advance.


#2

Tonight I had an idea to make what I want.
To comunicate JUCE with a html page contained in webBrowserComponent, we could invoke an URL that load a custumized page in our file system.
This HTML page could have a javascript function that makes periodic httpRequests, and an iframe that load the google map. HttpRequest contains something like “IsThereSomethingNew?”, and are sent to a local TCP port opened from our juce app.

In our JUCE app, we could receive and decode the httpRequests and then send to our page a response with contains comands like “NothingToDoFromHere” or “HeyCentreTheMapInPosition:10.2323,30.2323”.

In our webPage, we could have other javascript functions that decode the httpResponse and invoke the google maps API to do what we want.
… A very simple web server in the juce/host side and a little mini-framework to decode httpResponses/commands in html side.

(Sorry for my poor english)


#3

Yes, that does sound like it’d work!


#4

Hi again,
I was working on my idea for a few months.
I have not much time to work at home, so I only implemented the “setMapCenter (double latitude, double longitude)” that centers the map on the latitude and longitude indicated.

The following link, I leave you a zip with class “mapas”, an executable that loads a map and centers it in my village.

Much work remains to be done by implementing a wrapper for the Google API.
If you are interested in continuing my work, feel free to make any changes that you believe relevant. Then, please share your classes with the community.

Ciao