Link to home
Start Free TrialLog in
Avatar of theresadean
theresadean

asked on

IFRAME resizing issues in asp.net web applications.


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;
}

Parent page and child page are in in same domain
SOLUTION
Avatar of Marbleman
Marbleman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of theresadean
theresadean

ASKER

Ocassionally, the IFRAME will work perfectly in that I would get the correct height and I would see all the data that I need to see.  Plus we are using the same domain for the parent and child.
can you supply a link to the complete page?
I won't be able to because it contains sensitive data.

I should have mentioned this earlier, but there's another parent page(default.aspx page), which the master page of the web application is the child, and the web app is in the master page.  The master page and the its web application are both inside the default.aspx page.
I am sure there is a solution but without some code to test it is impossible to figure that out. You should store the html-Source from the browser and set up a little test scenario without sensitive data
Attached are two files:  IFRAMEERROR.bmp(where a user was attempting to use it outside our network.  The gray footer box is covering the rest of the data), and IFRAMEWORKS.bmp(where the iframe works when accessing the site within our network.  The gray footer box is not covering any of the data).  You'll notice the user and myself are not using the same exact browser versions, but this is happening on any Firefox or IE browser we use.

also the javascript code is in a js file, which gets initialized in the page_init sub in the master page

 Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim portalScript As New HtmlGenericControl
        Dim globalScripts As New HtmlGenericControl
        Dim configVariable As String = ""
        Dim jsSource As String = ""
        Dim otherScripts As String = ""

        configVariable = System.Configuration.ConfigurationManager.AppSettings("PortalEnvironment")

        If Not configVariable Is Nothing Then
            If Not configVariable = "local" Then
                jsSource = ResolveUrl("~/App_Javascript/KIT_Resizer.js")

                portalScript.TagName = "script"
                portalScript.Attributes.Add("type", "text/javascript")
                portalScript.Attributes.Add("language", "javascript")
                portalScript.Attributes.Add("src", jsSource)

                Me.Page.Header.Controls.Add(portalScript)
            End If
        End If

        otherScripts = ResolveUrl("~/App_Javascript/global.js")

        globalScripts.TagName = "script"
        globalScripts.Attributes.Add("type", "text/javascript")
        globalScripts.Attributes.Add("language", "javascript")
        globalScripts.Attributes.Add("src", otherScripts)

        Me.Page.Header.Controls.Add(globalScripts)
    End Sub
IFRAMEERROR.bmp
IFRAMEWORKS.bmp
Hey Marbleman,

Have any thoughts or ideas why this is happening based on what I've sent to you?

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial