最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why do I keep getting the error trying to load googlemaps? - Stack Overflow

programmeradmin2浏览0评论

I am trying to migrate from v2 to v3 in google maps API and I keep getting this error: The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".

Here is the tutorial I am using:

In the javascript I have changed src to

<script type="text/javascript"
  src=";sensor=TRUE">
</script>

but I keep getting the following error: The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".

What does the error mean and how can I fix it?

I am trying to migrate from v2 to v3 in google maps API and I keep getting this error: The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".

Here is the tutorial I am using: https://developers.google./maps/documentation/javascript/tutorial

In the javascript I have changed src to

<script type="text/javascript"
  src="http://maps.googleapis./maps/api/js?key=AIzaSyDzGdafsdfdfgoO4cHbfRGL8W23dgfafJKnA&sensor=TRUE">
</script>

but I keep getting the following error: The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".

What does the error mean and how can I fix it?

Share Improve this question asked Mar 31, 2012 at 19:43 StagletonStagleton 1,0603 gold badges13 silver badges35 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 4

Use: sensor=true instead of sensor=TRUE

It is case-sensitive.

In case anyone else is having a similar issue, I also got this error for a different reason.

In my case, the problem had to do with an extra line break and spaces that were inserted in the code when I copied and pasted an example from Google's website.

This line was the problem:

<script type="text/javascript" src="https://maps.googleapis./maps/api/js?key=YOUR_KEY_HERE&sensor=false">

Make sure to squeeze everything right together, nice and neat, or it won't parse the code correctly.

Ran into the same problem. If you already have the right key and all lowercase for the sensor boolean, make sure you have specified your map dimensions. For example, from the tutorial:

<style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map-canvas { height: 100% }
</style>

Make in this manner. Please check there is no space between ?and sensor.

发布评论

评论列表(0)

  1. 暂无评论