i have base page in using iframe of different domain. content gets render if user click on link rendered inside iframe open normal page. want opened in iframe only.
for information, can control base page application hosted on different domain.. want in iframe.
in simple words whole site opened in iframe, user should able work in iframe only. click on link inside iframe should not open in browser. can create central application can open application(existing) in iframe. if user open application seperatly can work.
technically, use .postmessage() child content inside iframe send message parent change iframe source on button clicks.
note, work if have control of child code getting rendered inside iframe, cannot tell question.
example, in child site, inside iframe, need code send parent page (outside iframe) when click inside iframe site:
self.parent.postmessage("stringsayingdosomething", "*");
then, parent site has event listener set receive message , perform action.. action can doing on parent side.. or, sending message down child site instead:
window.addeventlistener("message", receivemessage, false); function receivemessage(event) { switch (message) { case "stringsayingdosomething": domyfunctionnowthatchildframehastoldmeto(); break;
here question on stack overflow addressing issue: communicating cross-origin parent child iframe
Comments
Post a Comment