Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
150
rated 0 times [  154] [ 4]  / answers: 1 / hits: 24919  / 13 Years ago, tue, october 18, 2011, 12:00:00

I doubt this is actually possible but Im prepared to be corrected.



What I need is to be able to detect the width and height of an iframe from within the iframe, so if the iframe src is iframeContent.html I need to be able to surface the values on this page.



I have no control over the page that hosts the iframe only the contents of the iframe.



Is this possible?


More From » html

 Answers
4

Nowadays this is as simple as:


<script>
console.log(innerWidth, innerHeight)
</script>

Just make sure to load this JavaScript from within the iframe and it will print the iframe window's width and height in the browser's console.


[#89554] Monday, October 17, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anders

Total Points: 295
Total Questions: 106
Total Answers: 104

Location: Angola
Member since Wed, Apr 13, 2022
2 Years ago
;