How to get the iframe height in firefox?

Member

by orpha , in category: Javascript , a year ago

How to get the iframe height in firefox?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by jerad , a year ago

@orpha 

To get the height of an iframe in Firefox, you can use JavaScript. Here's an example code snippet:

1
2
3
var iframe = document.getElementById("your-iframe-id"); // Replace "your-iframe-id" with the actual ID of your iframe element
var iframeHeight = iframe.contentWindow.document.body.scrollHeight;
console.log(iframeHeight); // Print the height in console


This code retrieves the iframe element using its ID, then accesses the body of the iframe's contentWindow.document and gets the scrollHeight property which represents the total height of the content inside the iframe. Finally, it logs the height in the console.