<div dir="ltr">Dear All <br>I found the problem by using JSLint, <br><br>it works in IE7 after removing <br>if (!OpenLayers.Event.isLeftClick(evt)) return;<br><br>All the best <br><br>Xiaoyu<br><div class="gmail_quote">On Tue, Aug 19, 2008 at 9:49 AM, Xiaoyu Guan <span dir="ltr"><<a href="mailto:guanxiaoyu@gmail.com">guanxiaoyu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">Dear All:<br>I use Geoserver + Tilecache + Openlayers. I have a identifier which only work on Firefox. but on IE7 , not sure about IE6. <br>
<br>What I did, I have four Layers , two TileCache layers, two Geoserver layers. I hide two geoserver layers in layerswitcher. People in the map viewer only can get TileCache layers. I can use WMS getfeatureinfo from Geoserver. the identifier is base on Geoserver. some poeple told me that IE and Firefox is different when they reading an array. I have check my script for many times. but still cannot figure it out. Is there anybody can help me to figure it out?<br>
<br>/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.<br> * See <a href="http://svn.openlayers.org/trunk/openlayers/release-license.txt" target="_blank">http://svn.openlayers.org/trunk/openlayers/release-license.txt</a> <br>
* for the full text of the license. */<br><br>/**<br> * @requires OpenLayers/Control.js<br> * <br> * Class: OpenLayers.Control.FeatureInfo<br> *<br> * Inherits from:<br> * - <OpenLayers.Control><br> */<br>OpenLayers.Control.FeatureInfo = OpenLayers.Class(OpenLayers.Control, {<br>
<br> requestURL: null,<br> <br> initialize: function(options) {<br> OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); <br> },<br><br> destroy: function() {<br>
<br> <br> this.map.events.unregister( 'click', this, this.getFeatureInfo );<br> <br> OpenLayers.Control.prototype.destroy.apply(this, arguments); <br>
},<br><br> draw: function() { <br> OpenLayers.Control.prototype.draw.apply(this, arguments);<br> <br> return this.div;<br> },<br> <br> activate: function() {<br>
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {<br> this.map.events.register('click', this, this.getFeatureInfo);<br> <br> return true;<br> }else{<br>
return false;<br> } <br> },<br> <br> deactivate: function() {<br> if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {<br> this.map.events.unregister( 'click', this, this.getFeatureInfo ); <br>
return true;<br> } else {<br> return false;<br> }<br> },<br> <br> getFeatureInfo:function(evt){<br> <br> if (!OpenLayers.Event.isLeftClick(evt)) return;<br>
/* Here I removed two TileCache Layers from map.layers <br>Maybe the reason is I use slice<br>*/<br> var url = this.map.layers.slice(2)[0].getFullRequestString(<br> {<br>
REQUEST: "GetFeatureInfo",<br> EXCEPTIONS: "application/vnd.ogc.se_xml",<br> BBOX: this.map.layers.slice(2)[0].map.getExtent().toBBOX(),<br>
X: evt.xy.x,<br> Y: evt.xy.y,<br> <br> INFO_FORMAT: 'text/html',<br> QUERY_LAYERS: this.map.layers.slice(2)[0].params.LAYERS, <br>
FEATURE_COUNT: 50,<br> WIDTH: this.map.size.w,<br> HEIGHT: this.map.size.h<br> },<br> <br> "<a href="http://127.0.0.1:2008/geoserver/wms" target="_blank">http://127.0.0.1:2008/geoserver/wms</a>"<br>
); <br> OpenLayers.loadURL(url, '', this, <br> function(response) {<br> <br> var lonlat = this.map.getLonLatFromViewPortPx(evt.xy);<br>
<br> var popup = new OpenLayers.Popup.AnchoredBubble(<br> <br> " ",lonlat, null, response.responseText, null, true);<br> <br> this.map.addPopup(popup, true ); <br>
});<br> OpenLayers.Event.stop(evt); <br> },<br><br> CLASS_NAME: "OpenLayers.Control.FeatureInfo"<br>});<br><br>Here is some related information about my script <br>
<a href="http://www.nabble.com/TileCache-%2B-GetFeatureinfo%28Geoserver1.6.4%29--td18753089.html" target="_blank">http://www.nabble.com/TileCache-%2B-GetFeatureinfo(Geoserver1.6.4)--td18753089.html</a><br><br>All the best <br>
<br>Xiaoyu<br clear="all">
<br>-- <br>Xiaoyu Guan (Sam)<br>Geo-information Science<br>Wageningen UR<br><br>
</div>
</blockquote></div><br><br clear="all"><br>-- <br>Xiaoyu Guan (Sam)<br>Geo-information Science<br>Wageningen UR<br><br>
</div>