api - google maps api 响应错误消息 "Resource interpreted as Image but transferred with MIME type text/html"

标签 api google-maps

我刚开始使用 googlemaps api。 当我打开页面时,它总是给我同样的错误信息, 这说 “资源解释为图像但使用 MIME 类型文本/html 传输”。 页面上什么也看不到。

我完全不知道怎么弄清楚哪里出了问题.. 我在下面粘贴我的代码。感谢您的帮助。

------------我的代码来自这里-------------------------------- ----------

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charaset="utf-8">
<title>Googlemap</title>
<script src="http://maps.google.com/maps/api/js?sensor=true&language=ja"></script>
<style>
    #map {
            width: 100%;
            height: 100%;
            }
</style>
</head>
<body>
<div id="map"></div>
<script>
    var latlng = new google.maps.LatLng(35.66, 139.69);
    var options = {
        zoom: 15,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById('map'), options);
</script>

</body>
</html>

------------我的代码到这里-------------------------------- ----------

最佳答案

您正在为 map DIV 分配相对宽度和高度,但您还需要为父元素(即 html 和 body)分配绝对或相对宽度和高度。

例子:

html, body, #map {
  width: 100%;
  height: 100%;
}

关于api - google maps api 响应错误消息 "Resource interpreted as Image but transferred with MIME type text/html",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10098929/

相关文章:

java - 多个 InfoWindows Android map V2

python 请求 - 使用 'idna' 编解码器编码失败(UnicodeError : label empty or too long) error

android - 如何通过 ADB 命令行逐步安装 Google Play 服务

javascript - 仅在 Rails 应用程序的某些页面上加载 Google map 脚本

php - 将 PHP 生成的 JS 变量发送到 Google map 的 JS 函数

google-maps - 为什么这些 Google 卫星 map 图 block 链接停止工作?

json - 如果 avro 模式包含联合,如何将 json 对象转换为 Avro 对象

api - Instagram api如何通过用户id获取最佳照片

api - 在不重定向到 PayPal 站点的情况下进行 PayPal 余额支付

.net - Powershell-将COM对象类型转换为字符串