2016-08-31 3 views
3

Google지도 (gmaps)를 사용하는 ZK (Java Spring) 애플리케이션이 있습니다. 내가 사용하는 ZK 버전은 7.0.3 EE입니다.구글 맵을위한 Google API ZK 애플리케이션 도메인 이름

내 응용 프로그램에서 Google API 키를 사용하지 않았으므로 시간이 지나면 맵핑을 올바르게 시각화 할 수있는 것처럼 보였습니다.

지난 7 월부터 API 키 사용이 필요해 졌으므로 API 키를 삽입하려고합니다.

그래서 https://support.google.com/cloud/answer/6158862?hl=en&ref_topic=6262490의 안내에 따라 애플리케이션 용 브라우저 API 키를 만들었습니다. 그런 다음, https://www.zkoss.org/zkdemo/reporting/google_map의 예를 다음 내 .zul 페이지에 다음 태그를 추가 : 나는 로컬 IP에서 웹 응용 프로그램에 액세스하는 경우지도가 제대로 표시되는지

<script type="text/javascript" content="zk.googleAPIkey='my api key'" /> 
<gmaps ...> 
</gmaps> 

참고. 다른 한편으로는 등록 된 도메인 이름 인 portal.mydomain.eu를 통해 맵에 액세스하는 경우 다음과 같은 오류 메시지가있는 회색 상자가 나타납니다 ("이 HTTP 리퍼러 (웹 사이트)의 요청을 수락합니다").) "* .mydomain.eu /"나의 도메인 이름을 삽입 한 다음

Oops! Something went wrong. 
This page didn't load Google Maps correctly. See the JavaScript console for technical details. 

는 자바 스크립트 콘솔 오류 메시지 (메시지 이탈리아에있는, 나는 각 라인 아래의 영어 번역을 삽입 한 경우 해당) :

GET 
http://portal.mydomain.eu/images/portal_footer.jpg [HTTP/1.1 404 Not Found 23ms] 
L’API Fullscreen con prefisso è deprecata, al suo posto utilizzare l’API senza prefisso. Per ulteriori informazioni consultare https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API controls.js:23:54 
***the Fullscreen API with prefix is deprecate, use insteass the API without a prefix. For further information ... *** 

"Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error" js:35:350 
"Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys" util.js:221:12 
"Google Maps API warning: RetiredVersion https://developers.google.com/maps/documentation/javascript/error-messages#retired-version" util.js:221:12 
"Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required" util.js:221:12 
"Google Maps API warning: InvalidClientId https://developers.google.com/maps/documentation/javascript/error-messages#invalid-client-id" util.js:221:12 
L’utilizzo di getPreventDefault() è deprecato. Al suo posto utilizzare defaultPrevented. 
***the usage of getPreventDefault() is deprecated. Use instead defaultPrevented.*** 

무엇이 잘못 될 수 있습니까? "브라우저 키"를 가지고 있거나 다른 종류의 키가 필요합니까?

편집 : 내가 대신 회색 하나의 흰색 상자를 참조 이것으로 링크 Whats the API Key for in Google Maps API V3?

<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script> 

에서 발견 된 하나 스크립트 태그를 대체하기 위해 노력하고에

자바 스크립트 콘솔 오류가 지금 Google Maps API error: RefererNotAllowedMapError

당신은이 코드를 시도 할 수 있습니다
+0

최신 버전의 gmaps를 사용해 보셨습니까? 그냥 밖으로 v 3.0.4 : https://www.zkoss.org/download/zkgmaps – chillworld

+0

3.0.4 버전을 업데이트하고 작동합니다.고맙습니다.이 제안을 답변으로 다시 게시하여 받아 들일 수 있도록하십시오. – chrx

답변

0

:

또한 API를 v2에서 v3으로 업그레이드해야합니다. 버전 2까지의 Google지도에는 API 키가 필요했습니다.

자세한 내용은 link을 참조하십시오.

+0

제안을 시도했지만 'Google지도 API 경고 : NoApiKeys', Google Maps API 경고 : SensorNotRequired 및 Google Maps API 오류 : MissingKeyMapError' 오류가 발생했습니다. 또한 2016 년 6 월 22 일부터 Google지도 V3는 더 이상 키없는 액세스를 지원하지 않습니다. http://stackoverflow.com/questions/2769148/whats-the-api-key-for-in-google-maps-api-v3 – chrx

+0

내가 이전에 연결 한 스레드에서 제안한 내용에 따라 스크립트를 변경하려고 시도했습니다. 댓글 : 소식 수정보기 – chrx

2

업데이트 된 질문에 대한 답변은 documentation에서 찾을 수 있습니다. 기본적으로 RefererNotAllowedMapError은 API를로드하는 URL이 리퍼러 목록에 추가되지 않음을 나타냅니다.

The current URL loading the Google Maps JavaScript API has not been added to the list of allowed referrers. Please check the referrer settings of your API key on the Google API Console.

See API keys in the Google API Console . For more information, see Best practices for securely using API keys .

관련 문제