Log in

View Full Version : iframe help needed...



atari37
04-13-2007, 06:35 AM
I'm working on a company's department webpage (pages that monitor datacenter equipments), I have one index.html file with menus on the left_nav, and iframe in the body. Now, when I click on a menu item (link), it is supposed to open that page in my iframe. It works for most of the pages but one of the links open in a new window even though the target is the name of my iframe. So I looked at the source code for that page and didn't like what I saw, there's a script (see below) in there to prevent the page from opening in an iframe so my question is "How do I override this?" PLEASE help. These pages are like the index pages that come up when you type your routers ip address in a browser so I doubt that it can be edited.

Note: It will be very easy to comment out the script but I don't have access to the file.

<script language="JavaScript" type="text/javascript" >
// This script makes sure that our top level frame is not within
// some unknown frame which may mess up the viewability due to it
// being smaller than we need. This would be useful if someone
// else has a link to this page within a frame window.
if (parent.location != self.location)
{
parent.location = self.location.href
}

NXArmada
04-13-2007, 12:40 PM
You Can't override it. That I know of.

mburt
04-13-2007, 01:14 PM
Try this:

window.onload=function() {return parent.location;}
It may override it, I'm not sure. It tries to return the default value of parent.location.

jscheuer1
04-13-2007, 05:13 PM
Try this:

window.onload=function() {return parent.location;}
It may override it, I'm not sure. It tries to return the default value of parent.location.

That won't do anything except possibly interfere with other onload calls.

If you have access to the script:


<script language="JavaScript" type="text/javascript" >
// This script makes sure that our top level frame is not within
// some unknown frame which may mess up the viewability due to it
// being smaller than we need. This would be useful if someone
// else has a link to this page within a frame window.
if (parent.location != self.location)
{
parent.location = self.location.href
}

You could edit it, something like so:


<script language="JavaScript" type="text/javascript" >
// This script makes sure that our top level frame is not within
// some unknown frame which may mess up the viewability due to it
// being smaller than we need. This would be useful if someone
// else has a link to this page within a frame window.
if (parent.location != self.location && parent.location.href.indexOf('something')<0)
{
parent.location = self.location.href
}

What you put for:

something

could be the name of the top page that you want to have override this or, the name of the domain that the top page is on. For example, if your domain is:

somedomain.com

Do it like so:


if (parent.location != self.location && parent.location.href.indexOf('somedomain.com')<0)