0

My site uses Leaflet to build a map with multiple county outlines. Embedded within each GEOPoly file is a feature to indicate the website for the county. This all works great. BUT, what I would like to do is have the link include a target"_blank". How can this be done?

TIA for any assistance jdadwilson

jdadwilson
  • 17
  • 4
  • pls share your code – Falke Design Feb 05 '20 at 08:28
  • This is the code for one area...```var geoJsonLayer_attala = new L.GeoJSON.AJAX(window.SERVER_PATH + "files_geojson/geopoly_attala.json", {style: {color: "DarkGray", weight: 2, fillColor: "Green"}, onEachFeature: function (feature, layer) { layer.bindTooltip('Attala', {permanent: true, offset: [30,0], className: 'marker_tooltip'}), layer.on('click', function () { window.location = CO_URL_LINK['Attala']}) } }).addTo(map);``` – jdadwilson Feb 05 '20 at 17:24

1 Answers1

0

Update your click function:

layer.on('click', function () { 
    window.open(CO_URL_LINK['Attala'], '_blank');
})

https://stackoverflow.com/a/13158856/8283938

Falke Design
  • 10,635
  • 3
  • 15
  • 30