0

i want to work with google maps offline for my mobile application i used html 5 and google maps to development my app but some user needs use app offline so i want to use appcache manifest but it works for normal page that contains just js+css but does not work for google maps because google maps included that file and this is dynamic file https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false what should i do?

i made appCache as a below

cache.appcache file

CACHE MANIFEST
/index.html

NETWORK:
http://maps.gstatic.com/
http://maps.google.com/
http://maps.googleapis.com/
http://mt0.googleapis.com/
http://mt1.googleapis.com/
http://mt2.googleapis.com/
http://mt3.googleapis.com/
http://khm0.googleapis.com/
http://khm1.googleapis.com/
http://cbk0.googleapis.com/
http://cbk1.googleapis.com/
http://www.google-analytics.com/
http://gg.google.com/
http://csi.gstatic.com/
https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false/
http://mt0.google.com/ 
http://mt1.google.com/ 
http://mt2.google.com/ 
http://mt3.google.com/ 
http://maps.google.com/ 
http://maps.gstatic.com/ 

And then i made a html page that shows google maps as a below

index.Html

<!DOCTYPE html>
<html manifest="cache.appcache">
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
var map;
function initialize() {
  var mapOptions = {
    zoom: 8,
    center: new google.maps.LatLng(-34.397, 150.644)
  };
  map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>

But it does not work offline you can see demo URL here

user1688401
  • 1,851
  • 8
  • 47
  • 83

0 Answers0