0

So I have a web page that fetches content (two images) from two different servers. It simply does a HTTP GET nothing fancy.

I have some JavaScript in the page that calls document.getElementsByTagName('a') on the iframe. I get the following error --

"Blocked a frame with origin http://server1.example.com from accessing a frame with origin http://server2.example.com . Protocols, domains, and ports must match."

In my apache configuration file I added the following to the headers being sent out --

Header set Access-Control-Allow-Origin "*"

After this I see in the browser debugger that the header is in fact set.

But I still see the same error. Isn't this the expected workaround or solution to this? What am I missing? Do I not understand the same origin policy properly?

EDIT: This is ridiculous. People like myself ask on SO to get some knowledge. If I understood CORS or same origin policy I would have slved it myself. I have no idea why this is a duplicate of the other one. It did not seem like it is. Sometimes people with knowledge on SO enjoy talking down to less knowledgeable people. If you had let this remain open for a little while longer may be a kinder individual would have answered the question. But now it does not happen.

user220201
  • 4,514
  • 6
  • 49
  • 69

0 Answers0