4 ms·
A injected script element was last I checked the only way to send a piece of data to a remote server on a third party domain without a preflight OPTIONS request
by etaioinshrdlu 8y ago
A injected script element was last I checked the only way to send a piece of data to a remote server on a third party domain without a preflight OPTIONS request.
Less round trips. Less bandwidth.
For more reading look here:http://dev.housetrip.com/2014/04/17/unleash-your-ajax-requests-with-cors/ http://dev.housetrip.com/2014/04/17/unleash-your-ajax-reques...
But in general here's what is wanted.
- No OPTIONS request
- Third party domain.
- withCredentials - pass cookies in the request.
The best option in this case is actually a injected async script element.
Source: worked in ad tech a few years ago. Looked into all the possible options, this came up least bad, and explained why it was so popular.
- lancefisher 8y agoThat's right. Check out JSONP for more info: https://en.wikipedia.org/wiki/JSONP https://en.wikipedia.org/wiki/JSONP This was really common before CORS.
- Vinnl 8y ago> The best option in this case is actually a injected async script element. I thought dynamically injected script elements were async by default? https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement#Dynamically_importing_scripts https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptE...