开发者

How can I access the version number of the Google Maps API in Javascript?

Does the Google Maps Javascript API have a property/method that returns its exact version number?

I need th开发者_StackOverflowis info for debugging purposes.


To acccess exact version of Google Maps API one can check google.maps.version


When you include Google Maps API you can choose version of it. Example:

<script type="text/javascript" src="http://www.google.com/jsapi?key=LONG_KEY_HERE"></script>
<script type="text/javascript">
/*<![CDATA[*/
    google.load('maps', '2');
/*]]>*/
</script> 

Here we want to use version 2 of Google Maps API.


I suppose the G_API_VERSION could do :

This constant specifies the version of the API currently being served to your page.

I've just tested on two sites, and it contained things like "193c" and "140g".


In the Maps API v2, G_API_VERSION is what you want. For example, 193c means its loading v2.193c, 140g means 2.140g.

Changelog is here: http://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIChangelog

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜