[OpenLayers-Users] CORS

Andreas Hocevar ahocevar at opengeo.org
Tue Jan 3 05:51:31 EST 2012


If cross origin resource sharing is supported is only determined by
your browser, not OpenLayers. If you can control what your server
provides, you can either set the appropriate
Access-Control-Allow-Origin header and live with the fact that some
browsers don't support it, or use JSONP and OpenLayers.Protocol.Script
to make things work in all browsers. See
http://openlayers.org/dev/examples/cross-origin.html for an example.

Andreas.

On Fri, Dec 30, 2011 at 7:51 AM, Tomas Straupis <tomasstraupis at gmail.com> wrote:
> Hello
>
>  There is a php file serving a geoJSON (poi's) on a server A.
>  Html file with openLayers trying to use geoJSON info (Vector) is on server B.
>  Server B does not support curl/fopen, so I cannot have a working
> proxy.php there (or I do not know how).
>
>  I would not need a proxy.php on B if OpenLayers supports something
> like CORS, right? In that case I would just need to arrange/ask for
> CORS support on server A (probably something like this:
> http://remysharp.com/2011/04/21/getting-cors-working/).
>
>  Question: does OpenLayers support CORS? Google gives me different answers...
>
>  Thank you
>
> --
> Tomas Straupis
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list