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?
| SitePoint Sponsor |
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





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