How does Google's javascript API get around the cross-domain security in AJAX

前端 未结 5 2163
半阙折子戏
半阙折子戏 2020-12-14 04:11

How does Google\'s API make cross-domain requests back to Google, when it\'s on your website?

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 04:30

    Looks like Google display maps using the tag I guess they use the JavaScrit library to work out all the co-ordinates and other parameters the src url needs, then insert the tags (along with a million other tags) into your DOM.

    The full map is built up with several panes like the HTML below:

    (You can paste this HTML into your own web page to see the result)

    So Google Maps does NOT use AJAX or anything to get its maps, just plain images, created on the fly. So no Cross Domain issues to worry about...

提交回复
热议问题