!!更新しました !!Googleマップ実装の問題とAPI接頭辞エラー
正しく表示するにはGoogleマップを取得するのに少し問題がありますが、コンソールログにこのエラーが表示されます。私は例文hereにリストされている接頭辞を調整しようとしました。しかし、私はまだこれを正しく理解していないと感じています。誰も私のためにlaymansの言葉でこれを説明できますか?
1 - Prefixed Fullscreen API is deprecated. Please use unprefixed API for fullscreen. For more help https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API
私はerrornousコードがあると考えているところです。
// Google Map Element
var mapElement = document.getElementById('map');
// I added thes lines to try and solve the prefix error.
if (mapElement.requestFullscreen) {
mapElement.requestFullscreen();
}
EDIT:
わかりましたので、少しトラブルが試行錯誤の日々のカップルになっています。私はこの問題を回避しようとするにはいくつかの異なることを試しましたが、何がうまくいかないのか十分に理解できていません。
エラーログを更新するだけです。
1 - TypeError: google is undefined p-apollo:32:5
2 - Prefixed Fullscreen API is deprecated. Please use unprefixed API for fullscreen. For more help https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API controls.js:23:54
3 - "Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error" js:32:350
4 - "Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys" util.js:222:12
5 - "Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required" util.js:222:12
注:私は、生成され、院生いる 私はローカルで実行しているが、GoogleからAPIキーを捧げた。私はこれをコメントし、その場所に以下を追加しました。別の答えで述べたようにAPIのリリースバージョンを追加しようとしました。
<!-- Google Maps API -->
<script language="javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true&v=3"></script>
完全なコードチャンク
ちょうど私が私のGoogleマップのための場所で私が持っているコードのチャンクを追加したすべての拠点をカバーします。もし何かがそれをスキャンして、私はnoobエラーをしていないことを確認することができます、私はそれを感謝し、時には目の第二セットは解決策です。
でテスト<!-- Google Maps Script -->
<script type="text/javascript">
// create google map on doc load
google.maps.event.addDomListener(window, 'load', init);
function init() {
var mapOptions = {
zoom: 11,
// The latitude and longitude to center the map (always required)
center: new google.maps.LatLng(40.6700, -73.9400),
styles: [{
"featureType": "landscape",
"stylers": [{
"hue": "#FFBB00"
}, {
"saturation": 43.400000000000006
}, {
"lightness": 37.599999999999994
}, {
"gamma": 1
}]
}, {
"featureType": "road.highway",
"stylers": [{
"hue": "#FFC200"
}, {
"saturation": -61.8
}, {
"lightness": 45.599999999999994
}, {
"gamma": 1
}]
}, {
"featureType": "road.arterial",
"stylers": [{
"hue": "#FF0300"
}, {
"saturation": -100
}, {
"lightness": 51.19999999999999
}, {
"gamma": 1
}]
}, {
"featureType": "road.local",
"stylers": [{
"hue": "#FF0300"
}, {
"saturation": -100
}, {
"lightness": 52
}, {
"gamma": 1
}]
}, {
"featureType": "water",
"stylers": [{
"hue": "#0078FF"
}, {
"saturation": -13.200000000000003
}, {
"lightness": 2.4000000000000057
}, {
"gamma": 1
}]
}, {
"featureType": "poi",
"stylers": [{
"hue": "#00FF6A"
}, {
"saturation": -1.0989010989011234
}, {
"lightness": 11.200000000000017
}, {
"gamma": 1
}]
}]
};
// Google Map Element
var mapElement = document.getElementById('map');
if (mapElement.requestFullscreen) {
mapElement.requestFullscreen();
}
var map = new google.maps.Map(mapElement, mapOptions);
// Map Marker
var marker = new google.maps.Marker({
position: new google.maps.LatLng(40.6700, -73.9400),
map: map,
title: 'title'
});
}
</script>
: - Firefoxの47.0 - クローム51.0.2704.103
、あなたがそのようなファイルか何かの異なるバージョンを使用していないことを確認していますか? – gcampbell
私が知っているわけではありませんが、ちょっと上手くいってリフレッシュすると、1秒間動作してエラーをスローします。私はxamppを通してテストしています。 – Beaniie
あなたはどのブラウザを使用していますか? – gcampbell