SOP(Same Origin Policy): Security Protocol
SOP or Same Origin Policy is restrictive policy that prevent loading of document and malicious script from one origin to obtain access to sensitive data on another web page through that page's Data Object Model.
(Data Object Model is Application Programming Interface for valid HTML and XML documents and defines the logical structure of documents)
Lets take an example to get better understanding of SOP , You open your FACEBOOK account in a tab and then you open another web page in different tab which has some JavaScript code that attempts to access information from your FACEBOOK page, that the point where Same Origin Policy kicks in, as soon attempt is made to get access from some other domain then this policy prevent interaction.
Origin of a webpage is based on hostname, protocol and port number . The path of the page doesn't matter as long as these three things are satisfied. Data stored in localstorage is also governed by SOP.
Let take an example exhibiting different SOP result based on above mentioned things when compared with origin :
http://xyz/abc/cc.html
Comments
Post a Comment