Search code examples
javascriptsame-origin-policy

Implications of JavaScript same origin policy on dynamic image loading


If JavaScript has a same origin policy, does that mean that I can't dynamically load images from a different domain?


Solution

  • No, the same origin policy does not apply to <img> tags.

    There are other notable exceptions, some of which are described in that Wikipedia article. They include:

    • Style-sheets
    • Scripts (this is how JSONP works)
    • Form submissions