我想从 WFS 源加载功能,单击功能并弹出显示此功能信息的弹出窗口。我的代码是这样的:
` var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
featureLayer = new OpenLayers.Layer.Vector("WFS点图层", {
version: "1.1.0",
protocol: new OpenLayers.Protocol.WFS({
url: "http://172.31.4.122:8090/iserver/services/data-XinDiTu/wfs100/utf-8",
featureType: "BaseMap_P",
featureNS: "http://www.supermap.com/newdata",
featurePrefix:"newdata"
}),
renderers: renderer,
strategies: [new OpenLayers.Strategy.BBOX()]
});
map.addLayer(featureLayer);
var click = new OpenLayers.Control.SelectFeature(featureLayer, { onSelect: createPopup, onUnselect: destroyPopup })
map.addControl(click);
click.activate();'
这在 Internet Explorer 中运行良好,但在 Firefox 或 Chrome 中运行良好(单击该功能时没有响应)。我想知道它是否与跨区域访问有关,但我使用的是proxy.cgi,它可以工作。
所以有人请告诉我我的代码有什么问题吗?或者有没有其他方法可以做到这一点?