JavaScriptSame Origin Policy & Cross-Origin Communication

Download JavaScript for free


Same-Origin policy is used by web browsers to prevent scripts to be able to access remote content if the remote address has not the same origin of the script. This prevents malicious scripts from performing requests to other websites to obtain sensitive data.

The origin of two addresses is considered the same if both URLs have the same protocol, hostname and port.

Related Examples

Safe cross-origin communication with messages