¿Puedes decirme qué valor cambiar en v2 beta 5 que hará que esri leaflet use JSONP por defecto en lugar de CORS? <\/P>
<\/P>
Nuestra configuración SSO devuelve un '302 found' al usar las solicitudes CORS por defecto. Si hago el cambio a continuación, todo funciona bien.<\/P>
https:\/\/github.com\/Esri\/esri-leaflet\/blob\/master\/src\/Support.js#L1<\/A><\/P> exportar<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> ((<\/SPAN>window<\/SPAN>.<\/SPAN>XMLHttpRequest<\/SPAN> &&<\/SPAN> '<\/SPAN>withCredentials'<\/SPAN><\/SPAN> en<\/SPAN> nuevo<\/SPAN> window.XMLHttpRequest<\/SPAN>()));<\/SPAN><\/P> <\/P>exportar<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> falso<\/SPAN>;<\/SPAN><\/P> <\/P>La documentación muestra que la forma antigua de desactivar CORS por defecto es:<\/P>Si no puedes o no quieres habilitar CORS en tu servidor, el siguiente código hará que todas las solicitudes utilicen JSONP.<\/SPAN><\/P>L.esri.get = L.esri.Request.get.JSONP;<\/SPAN><\/P> <\/P>Pero las notas de la versión para Beta 2 dicen:<\/P>L.esri.Request<\/CODE> ha sido eliminado. Por favor usa L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> o L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
exportar<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> ((<\/SPAN>window<\/SPAN>.<\/SPAN>XMLHttpRequest<\/SPAN> &&<\/SPAN> '<\/SPAN>withCredentials'<\/SPAN><\/SPAN> en<\/SPAN> nuevo<\/SPAN> window.XMLHttpRequest<\/SPAN>()));<\/SPAN><\/P> <\/P>exportar<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> falso<\/SPAN>;<\/SPAN><\/P> <\/P>La documentación muestra que la forma antigua de desactivar CORS por defecto es:<\/P>Si no puedes o no quieres habilitar CORS en tu servidor, el siguiente código hará que todas las solicitudes utilicen JSONP.<\/SPAN><\/P>L.esri.get = L.esri.Request.get.JSONP;<\/SPAN><\/P> <\/P>Pero las notas de la versión para Beta 2 dicen:<\/P>L.esri.Request<\/CODE> ha sido eliminado. Por favor usa L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> o L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
L.esri.Request<\/CODE> ha sido eliminado. Por favor usa L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> o L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> o L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> o L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> o L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
L.esri.post<\/CODE> o L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
L.esri.request<\/CODE> directamente.<\/LI> <\/>\n<\/>\n <\/>\n¿Cuál es la nueva forma de hacer esto en beta 2?<\/>
Esri Leaflet only falls back onto JSONP when POSTing from a client browser that doesn't support CORS. if you'd like to trick our plugin into thinking that the end users browser doesn't support CORS, you can call...
L.esri.Support.cors = false;
Afterward, when calling L.esri.request(), JSONP will be used if its necessary to POST.
// to send a single JSONP ajax request L.esri.request('http://sampleserver6.arcgisonline.com/arcgis/rest/services/', { fakeParam: 'value that will push the request length past 2000 characters' }, function (error, response) { if (error) { console.log(error) } else { console.log(response) } })
If you need to POST across domains, please remember that it will be necessary to invoke a proxy.
we'll be updating the API reference soon, so i'll make sure the new information pertaining to L.esri.request() is as clear as possible.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.