Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
1.2k views
by The go-to Tester (232 points)
retagged by
What is same origin policy? How you can avoid same origin policy? Please help to show some ways!

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

As per Same Origin policity, you can access data from another page using script. But that page and script should be from the same origin. This is mainly for the security reasons. Say, you are on http://mayurshah.in and you login. Now navigate to http://www.mayurshah.in it will not show you logged in. This is to prevent cross domain hacking.

To avoid same origin policy, you will have to allow any origin on the server.

Example for Apache:
 
add following line to the server config file or .htaccess file.
 
Header set Access-Control-Allow-Origin "*"
 
To verify your changes,
 
apachectl -t
 
Now just restart the apache server.
 
sudo service apache2 reload
 
Also, altering requires the user of mode_headers so,
 
a2enmod headers
 
Hope that helps!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...