1

I am getting following error ,when trying to read iframe content whose src is other domain

SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "https://qa-xxx.abc.com" from accessing a frame with origin "https://yyy.abc.com". Protocols, domains, and ports must match.

Now Suppose right now i am in https://qa-xxx.abc.com doamin and my iframe code is

<iframe src="https://yyy.abc.com" style="height: 100%; width: 105%;" id="id_description_iframe"></iframe>

while searching i found this solution Access-Control-Allow-Origin not working for iframe withing the same domain

So i did like that document.domain = 'abc.com'

Still same Issue,Any Solution will be Helpfull.

Community
  • 1
  • 1
user3106347
  • 639
  • 2
  • 10
  • 27

1 Answers1

0

You're violating Same Origin Policy. Add: document.domain = abc.com to both of the pages. Either directly in a script tag, or in a referenced js file.

Cooper Buckingham
  • 2,503
  • 2
  • 15
  • 23