Google maps in jsFiddle

后端 未结 2 716
自闭症患者
自闭症患者 2021-01-25 10:19

I\'m trying to implement Google maps in jsFiddle to ask another question, but I can\'t see the map: http://jsfiddle.net/hashie5/aknYP/

I\'ve added the gmap script in the

相关标签:
2条回答
  • 2021-01-25 10:27

    There you go http://jsfiddle.net/aknYP/4/

    You were never calling initialize() nor loading the JS Google Maps API

    0 讨论(0)
  • 2021-01-25 10:32

    As explained here under "Add Resources" in a red box:

    Warning: jsFiddle is recognizing the type of the resource by the extension. If you want to use a dynamic resource please add a dummy GET variable i.e. http://example.com/download/js/dynamically.js?somevar=somevalue&dummy=.js. This will trick jsFiddle to recognize it as JavaScript resource.

    So to make jsFiddle recognize the Google Maps API (which indeed does not have .js extension) you need to add this as the resource: http://maps.googleapis.com/maps/api/js?sensor=false&dummy=.js (This is in addition to calling initialize of course)

    Updated fiddle.

    0 讨论(0)
提交回复
热议问题