Forum Moderators: open

Message Too Old, No Replies

FrameBuster

         

aax123

9:09 pm on Nov 12, 2005 (gmt 0)

10+ Year Member



I am trying to bust out of a frame but I don't want it to break out of all the frames, just 1. The code below breaks out of all but I only want it to break out of the divDetailIframe

There are other frames on the page but this is the 1 that I need to bust out of.

divDetailIframe.location.href = "/dnfserver/liners.aspx?q=liner&g=" + lid + "&t=" + t;

' Code that is ueed on the page I need to make visible in the middle of the page not the complete page.
Dim sb1 As New System.Text.StringBuilder
sb1.Append("<script language=""JavaScript"">" & Environment.NewLine)
sb1.Append("<!--" & Environment.NewLine)
sb1.Append("if (parent.frames.length > 0) parent.location.href = self.document.location;" & Environment.NewLine)
sb1.Append("-->" & Environment.NewLine)
sb1.Append("</script>" & Environment.NewLine)

lblFrameBuster.Text = sb1.ToString()

Any ideas how to do this? I thought this would work. middle.location.href = self.document.location;;

DrDoc

9:39 pm on Nov 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In addition to checking the frames.length you should also check the parent frame's name and compare. If it matches the one you want to break out of, do so :)

aax123

4:15 am on Nov 13, 2005 (gmt 0)

10+ Year Member



Does this look right then?

sb1.Append("if ((parent.frames.length > 0) && (parent.frames.name == ""divDetailIframe"")) parent.location.href = self.document.location;" & Environment.NewLine)