Můžete mi říct, jakou hodnotu změnit ve v2 beta 5, aby esri leaflet používal ve výchozím nastavení JSONP místo CORS? <\/P>
<\/P>
Naše nastavení SSO vrací '302 found' při použití výchozích CORS požadavků. Pokud provedu níže uvedenou změnu, vše funguje správně.<\/P>
https:\/\/github.com\/Esri\/esri-leaflet\/blob\/master\/src\/Support.js#L1<\/A><\/P> exportuj<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> ((<\/SPAN>window<\/SPAN>.<\/SPAN>XMLHttpRequest<\/SPAN> &&<\/SPAN> '<\/SPAN>withCredentials'<\/SPAN><\/SPAN> v<\/SPAN> nový<\/SPAN> window.XMLHttpRequest<\/SPAN>()));<\/SPAN><\/P> <\/P>exportuj<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> false<\/SPAN>;<\/SPAN><\/P> <\/P>Dokumentace ukazuje, že starý způsob, jak vypnout výchozí CORS, je:<\/P>Pokud nemůžete nebo nechcete povolit CORS na svém serveru, následující kód způsobí, že všechny požadavky budou využívat JSONP.<\/SPAN><\/P>L.esri.get = L.esri.Request.get.JSONP;<\/SPAN><\/P> <\/P>Ale poznámky k vydání Beta 2 uvádějí:<\/P>L.esri.Request<\/CODE> byl odstraněn. Použijte prosím přímo L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> nebo L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
exportuj<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> ((<\/SPAN>window<\/SPAN>.<\/SPAN>XMLHttpRequest<\/SPAN> &&<\/SPAN> '<\/SPAN>withCredentials'<\/SPAN><\/SPAN> v<\/SPAN> nový<\/SPAN> window.XMLHttpRequest<\/SPAN>()));<\/SPAN><\/P> <\/P>exportuj<\/SPAN> var<\/SPAN> cors <\/SPAN>=<\/SPAN> false<\/SPAN>;<\/SPAN><\/P> <\/P>Dokumentace ukazuje, že starý způsob, jak vypnout výchozí CORS, je:<\/P>Pokud nemůžete nebo nechcete povolit CORS na svém serveru, následující kód způsobí, že všechny požadavky budou využívat JSONP.<\/SPAN><\/P>L.esri.get = L.esri.Request.get.JSONP;<\/SPAN><\/P> <\/P>Ale poznámky k vydání Beta 2 uvádějí:<\/P>L.esri.Request<\/CODE> byl odstraněn. Použijte prosím přímo L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> nebo L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
L.esri.Request<\/CODE> byl odstraněn. Použijte prosím přímo L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> nebo L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
L.esri.get<\/CODE>, L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> nebo L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
L.esri.get.CORS<\/CODE>, L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> nebo L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
L.esri.get.JSONP<\/CODE>,L.esri.post<\/CODE> nebo L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
L.esri.post<\/CODE> nebo L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
L.esri.request<\/CODE>.<\/LI> <\/>UL> <\/>P> Jaký je nový způsob v beta 2? <\/>P>
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.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.