A frame is connected on the page.

I track the onClick event by frame and change its size:

document.getElementById('widget_iframe').onload = function() { document.getElementById("widget_iframe").contentWindow.document.getElementById('chat_header').onclick = function() { $('#widget_chat').animate({height: 400, width: 300}, 200); } document.getElementById("widget_iframe").contentWindow.document.getElementById('chat_header_full').onclick = function() { $('#widget_chat').animate({height: 40, width: 330}, 200); } } 

Everything works on one domain, if you connect an iframe on another domain, I get an error (work on http, not https):

Uncaught DOMException: Blocked a frame with origin " http: //main.domen " from accessing a cross-origin frame. at HTMLIFrameElement.document.getElementById.onload

Can you please tell me how to get around this limitation?

  • So it should be, it can not be done for different domains. - Raz Galstyan
  • Is your other domain? - Raz Galstyan
  • one
  • Thanks for the help! The other domain is also mine, but in the end the widget will be on another domain, so I wanted to identify the problem at an earlier stage. - Vasily Koshelev
  • If you do not have access to someone else's domain, in order to change all this, what was written in the answer, then it will not work out as planned. - Raz Galstyan

0