使用 javascript 访问外部网站上的谷歌地图标记
我正在研究如何将使用谷歌地图的网站组合在一起,并且我想使用 firebug 控制台以交互方式访问这些网站上的地图元素。
例如,通过此链接... http://maps.google.co .uk/maps?q=eh13&hl=en&z=12&vpsrc=0
您可以在控制台中输入:
gApplication.getMap().getCenter();
以及纬度 &将打印经度。
然而对于这个链接... http://www.primelocation.com/ uk-property-for-sale/search/?p=eh13&ls=0 我不知道如何在 javascript 中引用地图以及如何找到每个地图标记的坐标。
任何有关如何分析此类网站的帮助将不胜感激。
I am looking into how websites using google maps are put together and I want to access map elements on these website interactively using the firebug console.
For example, with this link...
http://maps.google.co.uk/maps?q=eh13&hl=en&z=12&vpsrc=0
You can type into the console:
gApplication.getMap().getCenter();
And the latitude & longitude will be printed.
However for this link...
http://www.primelocation.com/uk-property-for-sale/search/?p=eh13&ls=0
I cant figure out how to refer to the map in javascript and how I can find the coordinates of each of the map markers.
Any help on how to analyse websites like this would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
他们有一个“对象”,即地图,他们创建来处理他们的地图。他们将其存储在变量 window.map 中。您可以通过在控制台中输入以下内容来获取地图的中心:
这是他们定义对象的位置:
http://www.primelocation.com/content/scripts/map/tdpgmap.js
They have an 'object', Maps, they've created to handle their map. They store it in the variable window.map. You can get the center of the map by typing this in the console:
Here is where they define the object:
http://www.primelocation.com/content/scripts/map/tdpgmap.js
在控制台日志中尝试google.maps,您将可以访问某些属性......我认为
Try google.maps in the console log you will have access to some properties ... i think
您可以通过在调试控制台中访问
this.map
(按 Ctrl+Shift+I 并单击控制台)来访问您在 Chrome 中链接的页面上的地图。我想补充一点,如果不分析所有存储的 JavaScript 变量以查看它们是否属于
google.maps.Map
。You can gain access to the map on the page you linked in Chrome by accessing
this.map
in the debugging console (press Ctrl+Shift+I and click Console).I would add that it is rather difficult to determine what variable (if any) holds the Google map object for a given page without analyzing all stored JavaScript variables to see whether they are of the type
google.maps.Map
.