SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Loading a frame set from outside a frameset

    Hi,

    I need to open a page in a frame but the loading page has no frames. In other words, I first need to open the page frames.html and in the main window, I need to load a page.

    Anyone know how to do this?
    DomainnamesCenter.com - Lowcost Domain Name Registration Services

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    With javascript you can check if window == top
    If this is the case (page is not opened inside frameset), then change top.location.href to a page called frame.asp (or frame.php), and send the page name in the query string

    Something like this:
    if (window == top)
    {
    var page = location.href.substring(location.href.lastIndexOf('/') + 1);
    top.location.href = 'frame.asp?page=' + escape(page);
    }

    In frame.asp:
    <%
    page = Request("page")
    If page = "" Then
    page = "default.asp"
    End If
    %>
    <frameset rows="100,*">
    <frame name="frame1" src="somepage.asp">
    <frame name="frame2" src="<%=page%>">
    </frameset>


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
  •