Permalink
Browse files

Merge pull request #388 from tschaub/offline

Make cache writing work when cross-origin.
  • Loading branch information...
2 parents 5c597de + 2582e76 commit 0554637c5657d2cc65d90efb582158aba9682c9b @tschaub tschaub committed Apr 5, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/OpenLayers/Control/CacheWrite.js
@@ -173,11 +173,13 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
try {
var canvasContext = tile.getCanvasContext();
if (canvasContext) {
+ var urlMap = OpenLayers.Control.CacheWrite.urlMap;
+ var url = urlMap[tile.url] || tile.url;
window.localStorage.setItem(
- "olCache_" + OpenLayers.Control.CacheWrite.urlMap[tile.url],
+ "olCache_" + url,
canvasContext.canvas.toDataURL(this.imageFormat)
);
- delete OpenLayers.Control.CacheWrite.urlMap[tile.url];
+ delete urlMap[tile.url];
}
} catch(e) {
// local storage full or CORS violation

0 comments on commit 0554637

Please sign in to comment.