2011-03-08 44 views
10

我有一個嵌入iframe的谷歌地圖。就像這樣:Iphone/Ipad Google地圖Iframe嵌入

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" 
marginwidth="0" src="http://maps.google.de/?ie=UTF8&amp;ll=51.151786,10.415039& 
amp;spn=23.5119,51.723633&amp;t=h&amp;z=5&amp;output=embed"></iframe> 

在瀏覽器這是很好,但Iphone/Ipad試圖加載一個應用程序。這似乎只是工作正常(沒有一個我自己),但頁面加載和用戶得到一個彈出消息,詢問他是否要運行該應用程序。有沒有辦法在iframe中顯示地圖?

+0

有趣的問題。不能說我見過一個這樣的網站。它似乎總是加載一個應用程序。授予我不使用我的iPhone中的網絡瀏覽器太多.... – 2011-03-08 09:26:17

回答

7

我認爲最簡單的方法是直接使用Google Maps API加載Google地圖。

我最近遇到這個問題,我發現代碼this tutorial非常完整和有用。

+0

工程輝煌,謝謝! – Flo 2011-03-09 10:06:39

+0

你能詳細解釋一下嗎?我在我的網站的聯繫我們頁面上有Google地圖,根據Google地圖給我的代碼進行嵌入。它不適用於iPhone。點擊「查看大圖」或類似的東西,會將我帶到Google Maps應用程序,該程序可以正常工作,但網站上的地圖顯示爲空白,並顯示以下文本:'登錄,在移動設備上查看|經典,(c)2012 - 隱私,加載...'選擇'Mobile'並選擇'Loading ...'有一個永久旋轉的圖標。 – Xonatron 2012-02-13 16:01:50

+0

不幸的是,我認爲人們首先會使用嵌入方法,因爲它比使用API​​要容易得多。 – sam 2013-10-11 22:19:26

-1

我想這不加載HTML/iFrame中...

我感興趣過,這就是我如何管理(和它在一個iFrame的正常工作)一GoogleMap的正確方法:使用「蘋果的iWeb」小部件谷歌地圖......這是一個低成本的軟件...

它在 「myGoogleMap.html」 我的HTML代碼(後我丟棄所有未使用的HTML):

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it"> 
    <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 

    <meta name="iWeb-Build" content="local-build-20110308" /> 
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
    <meta name="viewport" content="width=700" /> 
    <title>Testo 
</title> 
    <link rel="stylesheet" type="text/css" media="screen,print" href="Vuoto_files/Vuoto.css" /> 
    <!--[if lt IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Vuoto_files/VuotoIE.css'/><![endif]--> 
    <!--[if gte IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Media/IE8.css'/><![endif]--> 
    <script type="text/javascript" src="Scripts/iWebSite.js"></script> 
    <script type="text/javascript" src="Scripts/Widgets/SharedResources/WidgetCommon.js"></script> 
    <script type="text/javascript" src="Scripts/Widgets/GoogleMap/GoogleMap.js"></script> 
    <script type="text/javascript" src="Vuoto_files/Vuoto.js"></script> 
    </head> 
<body style="background: rgb(0, 0, 0) margin: 0pt; " onload="onPageLoad();" onunload="onPageUnload();"> 

    <div class="com-apple-iweb-widget-GoogleMap aboveStrokesAndFrames" id="widget1" 
    style="height: 400px; left: 0px; opacity: 1.00; position: absolute; top: 0px; width: 320px; z-index: 1; "> 
    </div> 

    <script type="text/javascript"><!--//--><![CDATA[//><!-- 
new GoogleMap('widget1', 'Scripts/Widgets/GoogleMap', 'Scripts/Widgets/SharedResources', '.', {"language": "it", "showInfo": "0", "locatedAddressIsFromGeocoder": "1", "unlocatedAddress": "", "zoomLevel": "6", "center": "51.261915,10.151367", "locatedAddressPoint": "19.56661,-99.134932", "locatedAddress": "my address in Mexico, Pico de Orizaba 3A, Lomas de Cuautepec, Delegazione Gustavo A. Madero, Cittá del Messico, Distrito Federal, Messico", "showGoogleBar": "1", "showMarker": "1", "showZoom": "1"}); 
//--><!]]> 
    </script> 
</body> 
</html> 

我這個加載它在另外一個HTML:

<iframe width="320" height="400" frameborder="0" scrolling="no" marginheight="0" 
marginwidth="0" src="Sito-test/myGoogleMap.html"> 
</iframe> 
當然

你需要使用iWeb犯了太多的JavaScript,但我不知道我可以合法地向他們展示...

無論如何,重點是,現在你知道可以在沒有「安裝應用程序問題」的情況下將其加載到iFrame中...

相關問題