VAIBHAV SINGH Selenium Interview Question |
Question : What is Same Origin Policy(SOP)? |
SOP is an important concept in web application security model. It ensures that content of one site will never accessed by another site cause they belong to different origin. Origin basically represents combination of URI scheme, hostname, and port number. Example : Same Origin policy prohibits JavaScript code from accessing elements from a domain that is different from where it was launched. Have a look now, the HTML code in www.google.com uses a JavaScript program "testScript.js". The same origin policy will only allow testScript.js to access pages within google.com such as google.com/mail, google.com/login, or google.com/signup. However, it cannot access pages from different sites such as yahoo.com/search or fbk.com because they belong to different domains. How SOP works? Basically for every origin every browser create Sandbox in which all js files are present so that these sandbox create an abstraction between all |
Back |