Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsIFrameIFrameFeature Request -- IFrame Auto ResizingFeature Request -- IFrame Auto Resizing
Previous
 
Next
New Post
12/19/2007 8:21 PM
 

Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
New Post
12/20/2007 1:34 AM
 

Vitaly,
I added a similiar script to the upcoming release. I knew this script before, however I stopped reading at the copyright line to avoid any legal issues.

 
New Post
1/10/2008 12:09 PM
 

Hello,

I looked at the code you did on the IFrame.  Nice work.  One thing, since the user probably doesn't want to see the error about null or is nothing when trying to re-size the iframe on a site outside the domain, I edited the portion of the Resize String block in the catch to look like:

                                                            + "catch(err){ " _
                                                            + "var re = /null or not an object$/i;" _
                                                            + "if (re.test(err.message)) {}" _
                                                            + "  else { window.status = err.message; }" _
                                                            + "}}"

Also, I have been working on a module on and off myself over the years called Content Links that I have published here on the forums a few times also for various DNN versions.  Well, I basically take the Links module and allow you to render a link inside a Pane as well as a new window or the entire window.  In doing so, I have to pseudo-inject an IFRAME into the Pane to get it to do this and pass it the parameters, hence I was running into the same issue with height.

Looking at the posts, the 100% height, doesn't work for IFRAME by itself, BUT if the container also has a 100% height, or possibly some height defined, I know it seems to work with 100% hieght, then it seems to stretch it.  It also worked for frames outside the domain.

Since I am injecting, what I did was locate the Pane I was referencing and inject the frame, with:

Private Function InjectIFrame(ByVal PaneID As String, ByRef htmIFrame As HtmlGenericControl) As Boolean
Dim ctlPane As Control
            Dim bRet As Boolean = False
            Dim strPane As String

            Try
                For Each strPane In PortalSettings.ActiveTab.Panes
                    If strPane.ToLower.Trim = PaneID.ToLower.Trim Then 'Make sure we are checking only valid Panes
                        ctlPane = DotNetNuke.UI.Skins.Skin.GetParentSkin(Me).FindControl(strPane)
                        If Not ctlPane Is Nothing Then
                            If ctlPane.ID.ToLower.Trim = PaneID.ToLower.Trim Then

                                'Mod Pane Style for 100% height if IFrame has 100% Height.
                                'Also Check For and Remove DNNEmptyPane Class Element From Pane

                                If TypeOf ctlPane Is HtmlControl Then
                                    With CType(ctlPane, HtmlControl)
                                        If .Style.Count > 0 Then
                                            If .Style.Value.Contains("height") Then
                                                .Style("height") = htmIFrame.Style("height")
                                            Else : .Style.Add("height", htmIFrame.Style("height"))
                                            End If
                                        Else : .Style.Add("height", htmIFrame.Style("height"))
                                        End If

                                        If .Attributes.Count > 0 Then
                                            Try
                                                .Attributes("class") = .Attributes("class").Replace(" DNNEmptyPane", "")
                                            Catch ex As Exception
                                            End Try
                                        End If
                                    End With
                                End If

                                ctlPane.Controls.Add(htmIFrame)
                                bRet = True
                            End If
                        End If
                    End If
                Next
            Catch
            End Try
            Return bRet
        End Function

In my links code, I was creating an IFRAME as htmIFrame, then I would pass it to this function and also pass the name of the Pane I want to inject it to, such as ContentPane or LeftPane as a string value.  In here, it would check if the IFRAME has a height set, if it does, it will set the Pane to be the same height.

In my generation of the iframe, I will add an htmIFRAME.Style.Add("height", "100%") and it seems to work fine and expands to the full height of the TD for the pane.

First time I think I have gotten it to work and it has taken me a few years on an off to also figure out I needed the GetParentSkin to refrence the correct Pane, otherwise you will wind up injecting into the wrong container.

Hope this helps someone.

 
New Post
1/10/2008 5:35 PM
 

Very interesting post!

One note, however, in order to avoid confusion. 100% height is not the same as autosize, because autosize sets parameters to the same values as the page being "framed" whereas 100% height refers to the container tag of the IFRAME tag.

So, 100% height can be used to fill up the parent tag's space while autosize would shrink or stretch the iframe to the size of the page it displays. Of course, all of that is still subject to containing tags layout settings - for example overflow style, etc.


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
New Post
1/14/2008 11:31 AM
 

Vitaly Kozadayev wrote

Very interesting post!

One note, however, in order to avoid confusion. 100% height is not the same as autosize, because autosize sets parameters to the same values as the page being "framed" whereas 100% height refers to the container tag of the IFRAME tag.

So, 100% height can be used to fill up the parent tag's space while autosize would shrink or stretch the iframe to the size of the page it displays. Of course, all of that is still subject to containing tags layout settings - for example overflow style, etc.

 

Very true.

Actually the code above is doing the opposite technically of the initial setting of the autosize, it is setting the parent container to be the same size as the IFRAME, which could be any value technically.  The reason I do this, is in the code that is calling this function I actually check the Pane to see if it has any width/height attributes defined and if it does, I add the attributes to the IFRAME.  If it does not, I add 100% width, height to the IFRAME, so in essence, if there was a pre-defined with/height, it would be re-assigned back to the pane, not causing any damage, but if there was not, it would propagate the 100% up, which would allow the IFRAME to fill the entire window.

You are correct as it does not handle re-sizing of the window when you re-size the parent window, but it will help in the initial sizing to pre-fill the entire window if you need it to.

I have noticed though on some skins, such as the default DNN skins, that if you only have 1 or 2 modules on the left and nothing on the right, since you are assigning a dynamic height, I think it is taking the height of the highest dynamic column.  In one case, I have 2 link modules which only takes about 1/2 the screen, so the pane only fills about 1/2 the screen, but that is all the taller the table row is because of the height of the link modules.  If I remove the 100% code, it only fills about 1/4 of the screen so it is stretching to the full height it knows about.  If you have a skin that has heights set for the panes, you can run code to itterate the attributes of the pane now that you can locate it and inherit the height/width of the pane and use it instead of 100%. 

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsIFrameIFrameFeature Request -- IFrame Auto ResizingFeature Request -- IFrame Auto Resizing


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out