Skip to content
Browser internals·Intermediate·Conceptual·1 min read

How does JSONP relate to the same-origin policy?

Short interview answer

JSONP worked around the restriction by loading a script tag, which isn't subject to the same read restriction, and executing a callback with the data. It has known injection risks and has been superseded by CORS for legitimate cross-origin data access.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Same-origin policy and CORS

Related questions