Site icon TestingDocs.com

Same Origin Security Policy

Overview

All modern JavaScript browsers enforce the Same Origin Security Policy. The same origin policy states that JavaScript is only allowed to read/modify HTML from the same origin as its JavaScript source.

What is Origin?

Let’s first understand the website content’s origin. Origin is defined by the protocol scheme, domain name( or the hostname), and the communication port of the URL.

http://example.com:8080/

For example, the below have the same origin.

The same origin policy creates a problem for JavaScript tests. For example, If we write a JavaScript (.js ) file designed to test functionality on the example.com domain, to comply with the policy we need to install that .js file on the example.com domain in order to write automated tests for that domain.

Selenium Tutorials

Selenium Tutorials on this website can be found at:

https://www.testingdocs.com/selenium-webdriver-tutorial

For more details on the Selenium, visit the official website at:

https://www.selenium.dev/

Exit mobile version