diff --git a/example/example.js b/example/example.js index b976810..7f6bffe 100644 --- a/example/example.js +++ b/example/example.js @@ -12,7 +12,7 @@ init(maplibregl); const protocol = new pmtiles.Protocol(); maplibregl.addProtocol('pmtiles', protocol.tile); -const PMTILES_URL = (location.href.indexOf('index.html') == -1) ? location.href + 'assets/cotas.pmtiles' : location.href.replace('index.html', 'assets/cotas.pmtiles'); +const PMTILES_URL = new URL('./assets/cotas.pmtiles', window.location.href).toString(); const p = new pmtiles.PMTiles(PMTILES_URL); protocol.add(p); p.getHeader().then(h => {