Update GPX Viewer

My GPX-Viewer had a problem in Firefox: For some visitors OpenStreeMap maps would be displayed with pink tiles and not the real map tiles. This is a known problem which occurs when the server being used to load the tiles does not send an appriopriate HTTP header for CORS.

I don’t have control over these servers – but fortunately there is a workaround in the OpenLayers library which I use, so the “pink tile” problem with OpenStreetMap maps in Firefox should not occur any longer.

The solution was to add the option crossOriginKeyword: null when adding the map layers:

map.addLayer(new OpenLayers.Layer.OSM.Mapnik(
        "OpenStreetMap Mapnik",
        { tileOptions : { crossOriginKeyword: null } } )

Also see http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/OSM-js.html#OpenLayers.Layer.OSM.tileOptions.

Leave a Comment

Your email address will not be published. Required fields are marked *