Question

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

Was it helpful?

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

OTHER TIPS

The same-origin policy is limited to document properties of another site. Images are not considered as document properties.

http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top