开发者

Get google maps object of map in iframe

I want to include a Google Maps powered application from an external page (www.marinetraffic.com) that already add开发者_如何学JAVAs its own markers (Ships). I integrate this map using an iframe (this is the way recommended by the map provider).

However I want to be able to jump to certain markers (put on the map by marinetraffic.com). How do I get the corresponding Google Maps object with jQuery?

I see two problems here:

  1. Get into the iframe DOM (using .content()? but how?)
  2. Get the instance of the Google Maps object to add markers, jump to markers, zoom etc...

Any hints are greatly appreciated!

Thanks!

Felix


If the iframe is from another domain then you'd get same origin policy exceptions, because that is considered cross site scripting and it is blocked by the browser.

Otherwise you can access the iframe and use selectors in the following way:

$('#selector', frames['frame_name'].document).func_name();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜