Results 1 to 4 of 4

Thread: iframe help needed...

  1. #1
    Join Date
    Apr 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default iframe help needed...

    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
    }

  2. #2
    Join Date
    Apr 2006
    Posts
    190
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default

    You Can't override it. That I know of.
    Ryan
    Sevierville, TN

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

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

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by mburt View Post
    Try this:
    Code:
    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:

    Code:
    <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:

    Code:
    <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:

    Code:
    if (parent.location != self.location && parent.location.href.indexOf('somedomain.com')<0)
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •