I'm using OpenLayers in version 2.13.1. On desktops everything is OK, alert is showing when I click on route. But on mobiles it is not working, probably touch event is not triggered.

var infoControl = new OpenLayers.Control.WMSGetFeatureInfo({
    url: '/wms',
    title: 'Identify features by clicking',
    layers: [ncn],
    infoFormat: 'application/json',
    formatOptions: new OpenLayers.Format.JSON,
    queryVisible: true

infoControl.events.register("getfeatureinfo", this, function (data) {

var map = new OpenLayers.Map(
        div: div,
        projection: "EPSG:900913", // WGS84
        featureEvents: true,
        layers: [mapboxLayer[1], mapboxLayer[0], ncn],
        controls: [infoControl],
        resolutions: [896, 448, 224, 112, 56, 28, 14, 7, 3.5, 1.75, 0.875],
        restrictedExtent: mapExtents,
        fractionalZoom: g_environment.isMobile(),
        isValidZoomLevel: function (zoomLevel) {
            return !isNaN(zoomLevel) && !(zoomLevel < MapViewOSGreenSpaceMap.prototype.MIN_ZOOM_LEVEL);

I have no idea what I should do... I never used OpenLayers and I have task to fix this.

As I see getfeatureinfo event should be triggered after getting response from WMS. But on mobiles no request to WMS is sent.

  • Are you sure the referenced openlayers libraries are the same? – nmtoken Jul 24 at 2:54
  • Yes, the same... – serek Jul 24 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.