perliedman / leaflet-control-geocoder

A simple geocoder form to locate places. Easily extended to multiple data providers.
http://www.liedman.net/leaflet-control-geocoder/
BSD 2-Clause "Simplified" License
564 stars 221 forks source link

403 Forbidden strict-origin-when-cross-origin #335

Open TKouchoanou opened 2 years ago

TKouchoanou commented 2 years ago

do you know what caused this error in the browser following a request like https://maps.wikimedia.org/osm-intl/15/16593/11272.png? Error : strict-origin-when-cross-origin

my dependencies": { "leaflet": "^1.5.1", "leaflet-control-geocoder": "^1.8.2",

}

my code

import L from 'leaflet'
import 'leaflet-control-geocoder';

function() {
            let address = $(this).data('departure-address');
            let id = $(this).attr('id');
            geocoder.geocode(address, function(results) {
                if(!results[0]) return;
                let lat = results[0].center.lat;
                let lng = results[0].center.lng;
                let map = L.map(id, {
                    attributionControl: false,
                    zoomControl: false
                }).setView([lat, lng], 15);
                L.tileLayer('https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png').addTo(map);
                L.marker([lat, lng], {icon: greenIcon}).addTo(map);

                if (window.matchMedia("(max-width: "+utilities.breakpoints.lg+")").matches) {
                    map.dragging.disable();
                    map.touchZoom.disable();
                    map.doubleClickZoom.disable();
                    map.scrollWheelZoom.disable();
                    map.boxZoom.disable();
                    map.keyboard.disable();
                    if (map.tap) map.tap.disable();
                }
            });
        }