Oops, the formatting of the code snippet went haywire. Hope this is better:


[start of code snippet]

infoQuery = new OpenLayers.Control.WMSGetFeatureInfo({

  url: queryServerURL,  //Variable containing the URL of the WMS layer being 
queried

  maxFeatures: 1,

  title: 'Identify features by clicking',

  queryVisible: true,

  layers: [queryLayer],  //The WMS layer being queried

  eventListeners: {

    getfeatureinfo: function(event){

      if (map.getScale() 
From: [email protected]
Sent:2010-10-14 15:34:30
To: [email protected]
Cc: 
Subject: [OpenLayers-Users] Popup doesn't work on embedded map





Hi All,

I have developed an OpenLayers application which uses WMSGetFeatureInfo and 
Popup.FramedCloud to display a popup when the user clicks on a feature. 
Currently everything sits on the same server (WMS server, Apache, MapServer, 
map files, web pages, etc.) and the popup works nicely when the user clicks on 
a feature.

However, when I embed the map into a page from a different web site (i.e. the 
web page URL and the WMSGetFeatureInfo URL are different) the popup doesn't 
work any more. I've tried to track the problem using firebug and firebug gives 
an error "xmldom is null" whenever I click on a feature to activate the popup. 
It looks as if there is something wrong with the XMLHttpRequest. Has anybody 
had this problem before?

This is how I've defined the popup:

[start of code snippet]infoQuery = new OpenLayers.Control.WMSGetFeatureInfo({  
url: queryServerURL,  //Variable containing the URL of the WMS layer being 
queried  maxFeatures: 1,  title: 'Identify features by clicking',  
queryVisible: true,  layers: [queryLayer],  //The WMS layer being queried  
eventListeners: {    getfeatureinfo: function(event){      if (map.getScale() < 
400000) {        if (event.text.length != 0) {          map.addPopup(new 
OpenLayers.Popup.FramedCloud(            "querypopup",            
map.getLonLatFromPixel(event.xy),            null,            event.text,       
     null,            true          ));        };      };    }  
}});map.addControl(infoQuery);infoQuery.activate();[end of code snippet]

Are there any obvious error in my code that could be causing the problem?

Regards,
Frank.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to