[GIS] WMSGetFeatureInfo not showing in Firefox and chrome

getfeatureinfoopen-source-gisopenlayers-2wms

This code set works for me in IE but not in Firefox and chrome.What is the problem? Map is showing in all browsers ,but when i click on point of map nothing showing in Firefox and chrome.

Welcome any idea!

<!DOCTYPE html>
<html lang='en'>
<head>
<title>My OpenLayers Map</title>
 <script type='text/javascript' src='OpenLayers.js'></script>
 <link rel="stylesheet" href="1.css" type="text/css">
 <link rel="stylesheet" href="2.css" type="text/css">
 <script type='text/javascript'>
 var map;
 function init() {
 map = new OpenLayers.Map('map_element', {
 projection: 'EPSG:5235',
 maxExtent: new OpenLayers.Bounds(105097.88755998248, 181965.81596899,
 107146.57905998248, 183739.10926899),
 maxResolution: 156543.0339,
 units: 'm'
 })

var wms1 = new OpenLayers.Layer.WMS('OpenLayers      WMS','http://localhost:8080/geoserver/sac/wms',{layers: 'sac:Luse'},{});
var highlight = new OpenLayers.Layer.Vector("Highlighted Features", {displayInLayerSwitcher: false, isBaseLayer: false });

    map.addLayers([wms1,highlight]); 

    info = new OpenLayers.Control.WMSGetFeatureInfo({
        url: 'http://localhost:8080/geoserver/sac/wms', 
        title: 'Identify features by clicking',
        queryVisible: true,
        eventListeners: {
            getfeatureinfo: function(event) {
                map.addPopup(new OpenLayers.Popup.FramedCloud(
                    "chicken", 
                    map.getLonLatFromPixel(event.xy),
                    null,
                    event.text,
                    null,
                    true
                ));
            }
        }
    });
    map.addControl(info);
    info.activate();

    map.addControl(new OpenLayers.Control.LayerSwitcher());
  if(!map.getCenter()){
  map.zoomToMaxExtent();
  }
  }

  </script>
 </head>
 <body onload="init()">
  <h1 id="title">Feature Info in Popup</h1>

  <div id="tags">
    WMS, GetFeatureInfo, popup
  </div>

  <p id="shortdesc">
    Demonstrates the WMSGetFeatureInfo control for fetching information
    about a position from WMS (via GetFeatureInfo request).  Results
    are displayed in a popup.
  </p>

  <div id="map_element" class="smallmap"></div>

  <div id="docs"></div>
  </body>
  </html>

Best Answer

can you try adding proxyhost for getting information? i am not sure proxy host will solve this problem, but it is useful to try and dont forget adding defination of variables, sometimes they really being big problem...

var info;

and proxyhost:

OpenLayers.ProxyHost = "proxy.cgi?url=";

some information about proxyhost you can read this.

i hope it helps you...

Related Question