Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Mobile - How to implement Google Maps on Externally Linked Pages
    primarykey
    data
    text
    <p>I am attempting to use Google Maps API 3 with jQuery Mobile and cannot get my external pages to load a map. I checked in Firebug and it appears that the map is being created but is hidden on the page. I can get the home page to load a map successfully and I can get external pages to load the map successfully using rel="external" attribute on the link. But for external pages not using rel="external" the map doesn't show up.</p> <p>Here is my code:</p> <p>index.html</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Index&lt;/title&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.4.4.min.js"&gt;&lt;/script&gt; &lt;script src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page"&gt; &lt;div data-role="header"&gt; &lt;h1&gt;jQuery Mobile&lt;/h1&gt; &lt;/div&gt; &lt;div data-role="content"&gt; &lt;ul data-role='listview' id='menu'&gt; &lt;li&gt;&lt;a href="pages/map.html"&gt;external map page (does not work)&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="pages/map.html" rel="external"&gt;map page with rel=external (works)&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>map.html</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Map&lt;/title&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.4.4.min.js"&gt;&lt;/script&gt; &lt;script src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; html { height: 100% } body { height: 100%; margin: 0px; padding: 0px } #map_canvas { height: 330px; width: 100%; margin: 0px; padding: 0px } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page"&gt; &lt;div data-role="header"&gt; &lt;h1&gt;jQuery Mobile&lt;/h1&gt; &lt;/div&gt; &lt;div data-role="content"&gt; &lt;h2&gt;Map&lt;/h2&gt; &lt;div id="map_canvas"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; function initialize() { var latlng = new google.maps.LatLng(40.716948, -74.003563); //console.log(latlng); var options = { zoom: 14, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), options); } $(function () { initialize(); }); &lt;/script&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>How can I get a Google Map to show up on an external page without using rel="external"?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload