views:

47

answers:

1

What is the real meaning of SOP (Same Origin Policy)?

I know it means that the Javascript code from one origin cannot accuess resources from another origin. But what exactly does the word "resources" mean? For example:

  1. Javascript code can access IMAGES from another site.
  2. Javascript code cannot make ajax request to another side.

But when you use JSON padding, after completing the loading of a padded script tag, the 3rd party script will call your specified callback -- Javascript code from one site is invoking a method of Javascript code from another. Does this violate SOP?

A: 

There are several types but if we don't specify:

SOP refers to a mechanism that governs the ability for JavaScript and other scripting languages to access DOM properties and methods across domains

Here you have an excellent description of different types of SOP.

Claudio Redi