troubleshooting Question

IE parent scrollheight after iframe resize

Avatar of Bob-Villa
Bob-Villa asked on
JavaScriptWeb Browsers
1 Comment1 Solution2431 ViewsLast Modified:
I use modal windows with a translucent background.
On the page that uses these windows I have an iframe that holds dynamic content and changes height.


page load iframe=1000px (H) set by style="height:1000px"
a click on content in iframe reloads it's content and parent.document.getElementById("iMPFrame").style.height changes to 500px (H) via some javascript code.
This works fine, the parent's scrollbar (in client's browser) disappears.
However, the parent's scrollHeight (parent.document.body.scrollHeight) still is set at 1000px. even though the true scrollHeight is a little over 500px.
When I launch the modal window the background assumes the old scrollHeight of 1000px (+surrounding content) instead of the correct value of 500px (+ surrounding content)

I can calculate the true height of the page by getting the iframe height + 96px but wonder why this is not working.

How can I get the correct scrollHeight of the parent without refreshing the parent?

<iframe style="height:1000px" id="frame1" src=""></iframe>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros