ALTERNATE CROSS-DOMAIN TECHNIQUES
Before CORS came about, achieving cross-domain Ajax communication was a bit trickier. Developers came to rely on parts of the DOM that could perform cross-domain requests as a simple way to make certain types of requests without using the XHR object. Despite the ubiquity of CORS, these techniques are still popular because they don't involve changes on the server.
Image Pings
One of the first techniques for cross-domain communication was through the use of the <img>
tag. Images can be loaded cross-domain by any page without worrying about restrictions. This is the main way that online advertisements track views. You can also dynamically create images and use their onload
and onerror
event handlers to tell you when the response has been received.
Dynamically creating images is often used for image pings. Image pings are simple, cross-domain, one-way communication with the server. The data is sent via query-string arguments and the response...