0

My webpage(wp1) has an iframe. The source of the iframe is another webpage(wp2). I have some javascript functions on wp1 which try to manipulate the contents of wp2. However , the browser gives " Blocked a frame with origin "null" from accessing a cross-origin frame." How can i get around this?

chiru player
  • 301
  • 3
  • 10

1 Answers1

1

According to the MDN page about postMessage, if your parent and child domains differ only by a subdomain (e.g example.com and subdomain.example.com), you can set document.domain to the same value on both pages and it should be enough to get it to work.

Accepted value for document.domain is that of the superdomain (example.com = ok, subdomain.example.com = nope), according to Same Origin Policy.

Watilin
  • 286
  • 3
  • 9