
CORS Essentials
By :

Access to DOM elements is allowed only when the request scheme, hostname, and port number match those of the current URI. A subdomain cannot share DOM elements with the parent domain.
http://
or https://
80
is implicit in http://
443
for SSL over https://
If the Scheme, Hostname, and port number do not match the DOM element, then resource sharing is prohibited as they do not share the same origin. Considering the domain http://www.example.com
, the following table provides various combinations of matching and mismatching origins:
URI | Match? | Reason |
---|---|---|
| Match | Same protocol and host |
| Match | Same protocol and host |
| Mismatch | Different host (www is a subdomain) |
| Mismatch | Different protocol(https://) |
| Mismatch | Same protocol and host but different port (81) |
| Mismatch | Different host (en is a subdomain) |
Internet Explorer (IE) implements two major differences when it comes to the same-origin policy:
http://www.example.com:80/dir/page1.html
http://www.example.com:81/dir/page1.html
These exceptions in Internet Explorer are non-standard and are not supported in other browsers. If an application is only viewed in Windows RT mobile or Internet Explorer, then these exceptions could be useful.
Change the font size
Change margin width
Change background colour