epyks23,

Tile2.html is not well-formed html as in '<div id="map"</div>' the 
opening 'div' tag is not closed. Any html editor with syntax colouring 
will alert you to this as will Firefox "Page Source" (Ctrl-U). Please 
use an editor with syntax highlighting.

At the moment, your html comes from local files <file:///something.html> 
and your XML data comes from <http://localhost:8080/geoserver> which are 
different origins for JavaScript security purposes.

"You can place static files in the www subdirectory of the GeoServer 
data directory, and they will be served at 
http://myhost:8080/geoserver/www. This means you can deploy HTML, 
images, or JavaScript, and have GeoServer serve them directly on the web."
http://docs.geoserver.org/latest/en/user/tutorials/staticfiles.html

In your case these files will be 
<http://localhost:8080/geoserver/www/Tile2.html> or similar.

If you use GeoServer to serve your static files, they will have the same 
JavaScript origin as your GeoServer web services and will not be 
affected by any of the JavaScript cross-origin rules; you can then 
remove all your cross-origin configuration. GetFeatureInfo will just 
work. In production there are even better ways to serve static content, 
such as a proxying apache web server instance, but you do not yet need this.

When you want to share your map with others, you will need to have 
GeoServer hosted on a server that others can access. They will also need 
to see the web services, html, js, and css as originating from the same 
JavaScript domain (protocol, host, and port).

Kind regards,
Ben.

On 08/01/16 10:27, epyks23 wrote:
> I added the layers in layer groups.   Tile2.html
> <http://osgeo-org.1560.x6.nabble.com/file/n5244198/Tile2.html>
>
> I added the GetFeatureInfo and get error:  cross.png
> <http://osgeo-org.1560.x6.nabble.com/file/n5244198/cross.png>
>
> I used "anonymous" and "use-credentials" for crossOrigin
> https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes
> <https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes>
>
> and get error:  error2.PNG
> <http://osgeo-org.1560.x6.nabble.com/file/n5244198/error2.PNG>
>
> What does it mean to deploy the html, js and css to deliver in server? (I
> want to eventually send this map to someone else and currently, they would
> not be able to see the map since it is hosted locally. Does this process
> have to do with making the map more public?)
>
>
>
> --
> View this message in context: 
> http://osgeo-org.1560.x6.nabble.com/layerswitcher-js-and-adding-vector-data-from-Geoserver-tp5243249p5244198.html
> Sent from the GeoServer - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>

-- 
Ben Caradoc-Davies <[email protected]>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to