我正在为一个项目使用Google Maps JS API v3。有没有一种方法可以要求地图在客户端的设备上缓存瓦片,这样当他们刷新浏览器时,就不必再次下载所有瓦片了?
我的许多客户都使用蜂窝移动数据连接,重新下载地图需要相当长的时间。
谢谢!
我正在为一个项目使用Google Maps JS API v3。有没有一种方法可以要求地图在客户端的设备上缓存瓦片,这样当他们刷新浏览器时,就不必再次下载所有瓦片了?
我的许多客户都使用蜂窝移动数据连接,重新下载地图需要相当长的时间。
谢谢!
默认情况下,谷歌地图会返回缓存的图像(您可以在控制台的网络选项卡中看到此选项)。
如果用户无法缓存图像,则可能是因为他们禁用了缓存。
CACHE MANIFEST
/map/mobile/examples/template.aspx
/map/mobile/examples/template.css
/map/mobile/examples/template.js
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/
您需要完全基于HTML5,并意识到这将对您的用户产生影响。如果您的用户已经更新了浏览器标准/设备或者您可以控制用户选择,那么这种情况非常方便。
希望这能帮助到您。
NETWORK:\n*
(\n 表示换行)前加上一些内容,列出所有可缓存的内容。编辑:哦,我看到有人误解了 NETWORK 部分,它是指不被缓存的文件。URL 也可以列在上面的列表中。 - Ciantic# here is a file for the online whitelist -- it isn't cached, and
# references to this file will bypass the cache, always hitting the
# network (or trying to, if the user is offline).
NETWORK:
comm.cgi
/map/mobile/examples/template.aspx
/map/mobile/examples/template.css
/map/mobile/examples/template.js
2) 从网络中获取以下内容:
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/