Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IFRAME Resizing issue

Status
Not open for further replies.

pghdeveloper

Programmer
Sep 8, 2010
3
US
I have a master page that has an IFRAME, which we use for resizing. Locally, when we are using our web application within our network, the resizing works perfectly for both Firefox and IE. However, when I access the web application from outside the network the resizing doesn't always work. Most of the time, the offsetheight for the div(container is the name) is not correct, thus I don't see all the results that I need to see in the IFRAME Here is the resizing code below.

function resizeTheFrame() {
var iframe = document.getElementById('innerFrame');
var containerHeight = document.getElementById('container').offsetHeight;
var DefaultPageHeight = 400;
if (containerHeight > DefaultPageHeight) {
var heightdiff = 100;
}
else {
var heightdiff = DefaultPageHeight - containerHeight;
}
containerHeight = containerHeight + heightdiff;
var counter = parent.top.window.location.href.lastIndexOf("/");
var urlStr = parent.top.window.location.href.substring(0, counter + 1);
iframe.src = urlStr + "resizer.htm?height=" + containerHeight;
}
 
When running from outside your network are there cross-domain issues in play stopping you from being able to access the frame's properties correctly?

If so, check out this guide on how to resize iframes when there are cross-domain issues:
Note: The guide assumes you have access to the content inside the iframe, whether you are hosting it, or whether you can get modifications made to it somehow.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
The page hosting the iframe, and the iframe itself are coming from the same domain.
 
We call this function under page_load of the master page

Public Sub iFrameResizer()
Dim resizerScript As String = "@script>if (typeof resizeTheFrame == 'function') { setTimeout('resizeTheFrame()', 2000); }@/script>"
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "resizeFrame", resizerScript.Replace("@", "<"))
End Sub

The data does fully load before the function gets called because I'm able to see the data in the html source under firebug in firefox
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top