2

Just out of curiosity I was wondering how is it possible for the javascript code to embed google maps communicate with server from outside domain. I know I'm missing out something here. can anyone help?

thanks

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
Raja
  • 6,354
  • 9
  • 30
  • 34

1 Answers1

0

Because it writes an iframe, which then makes a request to google (so the javascript isnt actually loading from outside the domain)

EDIT: Google Maps actually uses JSONP. It loads pages as <script> elements and then that script calls a callback method that has already been defined on your page.

Mitch Dempsey
  • 38,725
  • 6
  • 68
  • 74
  • @downvoter ... was there a reason for that? This answer is correct, unless you have a better one. – Mitch Dempsey Apr 30 '10 at 20:10
  • 2
    You're wrong. The Google Maps API does not embed anything in an iframe. If you 'embed' a map from maps.google.com you do it as an iframe, but again there is no 'writing of an iframe' and this is different from using the Google Maps API. For more information on how to do bypass the same domain policy check out http://en.wikipedia.org/wiki/JSONP#JSONP – Ossama May 04 '10 at 18:51