Helo, I'm very much a newcomer to OpenLayers, and really any sort of web programming. With the help of various OL examples, I've tried creating a simple viewer for some of my GeoServers WMS layers.
The issue is the GetFeatureInfo request. Now, I've seen this referred to before in this forum, but always when the viewer pages have been hosted on some webserver. Currently, mine is not published anywhere, it's just sitting in a file on the same machine as the GeoServer is running on. The relevant code should be this: (copied from http://openlayers.org/dev/examples/getfeatureinfo.html ) map.events.register('click', map, function (e) { OpenLayers.Util.getElement('nodeList').innerHTML = "Försöker hämta attribut.."; var url = sv_vagar.getFullRequestString({ REQUEST: "GetFeatureInfo", EXCEPTIONS: "application/vnd.ogc.se_xml", BBOX: sv_vagar.map.getExtent().toBBOX(), X: e.xy.x, Y: e.xy.y, INFO_FORMAT: 'text/html', QUERY_LAYERS: sv_vagar.params.LAYERS, WIDTH: sv_vagar.map.size.w, HEIGHT: sv_vagar.map.size.h}); OpenLayers.loadURL(url, '', this, setHTML); OpenLayers.Event.stop(e); }); function setHTML(response) { document.getElementById('nodeList').innerHTML = response.responseText; } and then css stolen from GeoServers OL preview pages: <style type="text/css"> table.featureInfo, table.featureInfo td, table.featureInfo th { border: 1px solid #ddd; border-collapse: collapse; margin: 0; padding: 0; font-size: 90%; padding: .2em .1em; } table.featureInfo th { padding: .2em .2em; text-transform: uppercase; font-weight: bold; background: #eee; } table.featureInfo td { background: #fff; } table.featureInfo tr.odd td { background: #eee; } table.featureInfo caption { text-align: left; font-size: 100%; font-weight: bold; text-transform: uppercase; padding: .2em .2em; } </style> Now, this works in IE6 but not in FF. FF 3.0.15's error console reports (roughly translated) : "Security fault: contents of file (path to the local html-file) isn't allowed to fetch data from http://localhost:8080/geoserver/wms?LAYERS=sweden_ways&FORMAT=image%2Fpng&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_xml&SRS=EPSG%3A3006&BBOX=106524.93608%2C6533250.45206%2C1087113.063921%2C7268691.54794&X=723&Y=385&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS=sweden_ways&WIDTH=900&HEIGHT=675." and the 'loading' message in the div remains forever. It should be mentioned that the http://openlayers.org/dev/examples/getfeatureinfo.html works in FF if I run it from the page it's on, but FF shows the same security error if I attempt to run it from my machine (after changing it so it points to the publically hosted OpenLayers.js and removing its reference to a css file). So somehow this is a browser as well as a "from where are you running this bit of HTML/js" issue? Any tips would be very welcome, Yours truly, Lost in the ether, RT90. -- View this message in context: http://n2.nabble.com/GetFeatureInfo-works-in-IE-not-FF-beginner-wonders-why-tp4111448p4111448.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
