0

When some javascript trys to load an iframe when a popup is fired, it gives the error

Blocked a frame with origin "https://www3.example.com" from accessing a frame with origin "https://www.example.com". Protocols, domains, and ports must match.

I understand that is because of the security feature Same Origin Policy.

Can I allow this subdomain for dynamicly loaded by for eg setting .htacess headers? How? I've tried:

Header set Access-Control-Allow-Origin "*"
Content-Security-Policy: frame-ancestors 'self' https://www3.example.com;

Which have not solved it.

Update:

I'm not trying to "access" the iframe, just create it. I'm not sure if the suggested duplicate is the same thing.

Will
  • 4,498
  • 2
  • 38
  • 65

1 Answers1

0

This is due to the same origin policy, not content security policy. As the origin (scheme, host and port) differs, javascript is not able to access it. You must host both pages on the same subdomain for this to work.

Halvor Sakshaug
  • 2,583
  • 1
  • 6
  • 9