Reputation: 29
I want to Disable the WMS getFeatureInfo popup of Leaflet when I click outside the wms layerenter image description here I use this plugin https://gist.github.com/rclark/6908938
Upvotes: 1
Views: 1292
Reputation: 11338
Change your function to:
getFeatureInfo: function (evt) {
// Make an AJAX request to the server and hope for the best
var url = this.getFeatureInfoUrl(evt.latlng),
showResults = L.Util.bind(this.showGetFeatureInfo, this);
$.ajax({
url: url,
success: function (data, status, xhr) {
var err = typeof data === 'string' ? null : data;
//Fix for blank popup window
var doc = (new DOMParser()).parseFromString(data, "text/html");
if (doc.body.innerHTML.trim().length > 0)
showResults(err, evt.latlng, data);
},
error: function (xhr, status, error) {
showResults(error);
}
});
},
Source: https://gist.github.com/rclark/6908938#gistcomment-2277325
Upvotes: 1