Get accurate height of iframe of cross domain with no scroll

Create first webpage and include below code into this page

window.addEventListener('message', receiveMessage, false);

function receiveMessage(evt)
{
    alert("got message: "+evt.data);
}

Now create another webpage on other domain that you going to call in iframe inside first page and include below code into this page.

window.parent.postMessage('Hello Parent Frame!', '*');

when you will view first page , a message will be sent by cross domain webpage inside iframe and your first page will receive it and generate a alert.

you can change this alert event to some other even easily by editing first page code.

I have +4 years of quality experience in Front-End Developer from India. I have worked on HTML5, CSS3, JSON, XML, Angular, jQuery, WordPress, Bootstrap for developing tabled, table-less, responsive and non-Responsive web-sites. I have worked on many complicated and easy design in some top level web development companies in India while also working on independent projects as freelancer.

Comments are closed.