2015-06-25 48 views
1

當使用iframe來顯示谷歌地圖客戶端已成立,我不斷收到谷歌地圖的iframe賦予「的XMLHttpRequest無法加載」

「的XMLHttpRequest無法加載 https://accounts.google.com/ServiceLogin?service=mymaps&passive=1209600&continue=https://www.google.com/maps/d/gen204?a%3D58%26width%3D525%26height%3D295%26s%3D7&followup=https://www.google.com/maps/d/gen204?a%3D58%26width%3D525%26height%3D295%26s%3D7沒有「訪問 - 控制 - 允許來源標頭出現在所請求的資源。起源‘https://www.google.com’是爲此現在允許訪問。

我知道訪問的JSON對象時使用JSONP,但是這不是真的是我想要盡我所能去做。

的IFRAME代碼很簡單:

<iframe src="https://www.google.com/maps/d/embed?mid=CLIENTS_IDmsa=0&ie=UTF8&t=h&z=11&output=embed"></iframe> 

難道我需要某種關鍵的使用此地圖?

顯示地圖,但我想擺脫控制檯中的錯誤。

任何指針?

回答

1

您提供的網址:https://www.google.com/maps/d/embed?mid=CLIENTS_IDmsa=0&ie=UTF8&t=h&z=11&output=embed不適用於公衆。一個工作IFRAME SRC會是這樣的:

<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d2624.9983685732213!2d2.29432085!3d48.85824149999999!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47e66e2964e34e2d%3A0x8ddca9ee380ef7e0!2sgoogle+map+paris+eiffel+tower!5e0!3m2!1sfr!2sbe!4v1387990714927" width="800" height="600" frameborder="0" style="border:0"></iframe> 

和工作的jsfiddle example

而且這裏有一個documentation對谷歌地圖的iframe。

享受!