The web Same-origin policy 2 min read

What is the same-origin policy?

A script on a notes site asks to read a response from your mail site. You’re already signed in to mail. Why does the browser keep the response away from the script?

  1. Identify the caller and the response

    The script runs with the notes site’s origin. The mail response comes from a different origin. The browser uses that distinction to restrict what the notes script can read.

    Notes script → Browser check → Mail response Notes scriptBrowser checkMail response

    In short The browser checks which origin the script belongs to.

  2. Separate sending from reading

    Some cross-origin requests can still be sent. The browser can keep the calling script from reading the response even when a request reaches the server. Servers must still check access and protect actions that change data.

    In short A browser restriction on reading does not replace server-side checks.

Where this applies

Cross-origin embedding and navigation have their own rules. A server can also use CORS to let selected origins read a response.

Keep this

Treat the response as belonging to its origin.

Ask whether you are debugging a request being sent or a script being allowed to read the response.

Sources

Last reviewed 21 November 2026.

Next byte · The web What is CORS?