WebHTMLViewer don't show google-sites

Hi,
I’m just about to write a Map “Control”. I use the googlemaps API.

Now I want to show a google-website, but the (web) HTMLviewer doesn’t do. Not even the Main-Google-Page. On other website works it!

This is one of a link, I want to show:
http://maps.googleapis.com/maps/api/geocode/json?address=Reitbahnstrae 42, 09111 Chemnitz&sensor=true

What is the reason - is there an alternative?

Thanks a lot!

Google can’t be displayed in a WebHTMLViewer. Google prevents itself from being shown in an iFrame. The WebHTMLViewer is an iFrame.

Hmmm grmbl…
Is there an alternative It’s important for me…
:confused:

Do you want to show that JSON in the WebHTMLViewer?

Ya, but if it’s not possible, it would satisfy if I could get the content!

You should be able to get the POST results with an HTTPSocket. I did a quick test and it ALMOST works…maybe you can figure it out? :slight_smile:

This almost works…I’m missing something?

Dim d As New Dictionary
  Dim result As String
  Dim socket as New HTTPSocket
  
  d.Value("address") = "Reitbahnstrae 42, 09111 Chemnitz"
  d.Value("sensor") = "true"
  
  Socket.SetFormData(d)
  result = Socket.Post("http://maps.googleapis.com/maps/api/geocode/json", 30)
  MsgBox(result)

Well, nice solution!
But following exception in the Post:

{ "error_message" : "The 'sensor' parameter specified in the request must be set to either 'true' or 'false'.", "results" : [], "status" : "REQUEST_DENIED" }

I know, it almost works.
Kind of hoping someone could shine a light on that :slight_smile:
Have no idea why it’s failing.

It works if I use:

Dim d As New Dictionary
  Dim result As String
  Dim socket as New HTTPSocket
  
  result = Socket.Post("http://maps.googleapis.com/maps/api/geocode/json?address=Reitbahnstrae  42, 09111 Chemnitz&sensor=true", 40)
  MsgBox(result)

So I will only use a string.replace and thats it!

Thank you a lot (again^^)!!!

As far as I can Google Maps can be used in an iframe, as that’s how they allow you embed a map on your website…

http://img.labnol.org/files/responsive-google-maps.html <-- that map is in an iframe

Yes, only GMaps works in an iFrame - not other service (like these Geocode-JSON-Request)

I have to return to this.

I did rebuild this today, but I only got an error-message (translated with google):

[quote]ERROR

The requested URL could not be retrieved

During the experiment, the request

POST / maps / api / geocode / json? Reitbahnstra address =% C3% 9Fe% 2042% 2009111% 20Chemnitz & sensor = false & Language = en HTTP/1.0
Accept: * / *
Accept-Language: en
Host: maps.googleapis.com

process, the following error occurred:
Invalid request
A part of the HTTP request is invalid. Possible reasons:

Missing or unknown request method (GET, POST)
Missing URL
Missing HTTP Identifier (HTTP/1.0)
Request is too large
Content-Length missing for POST or PUT requests
Invalid characters in the hostname - for example, Underscores (’_’), umlauts and commas are not allowed.[/quote]

This is the String I use:

http://maps.googleapis.com/maps/api/geocode/json?address=Reitbahnstra%C3%9Fe%2042,%2009111%20Chemnitz&sensor=false

If I copy that into the Browser, it works!

This is the code:

[code]Dim d As New Dictionary
Dim result As String
Dim socket as New HTTPSocket
socket.HTTPProxyPort = 3128
socket.HTTPProxyAddress = “proxy01”

result = Socket.post(“http://maps.googleapis.com/maps/api/geocode/json?address=Reitbahnstraße%2042,%2009111%20Chemnitz&sensor=false&Language=de”, 30)
return result
[/code]

If I remove the proxy, I get an empty response.

Is it possble, that the reason is the proxy we use? Wouldnt stand there another Error-Message?