View Full Version : How to get a page to load within a frame that already exists?
08-01-2002, 04:31 PM
I see how to get a link to open within frames when the link is on an existing page, doing this works well - (main is the frame called from the index page to display the information)
The question is - if my customer has an existing link or shortcut on the desktop to the page http://stuff/mypage.html then what within the structure of the page would force it to open with the framework? I believe that it would run a check as shown below
//if not in frames
//CHANGE "index.htm" to the URL of your main frame page
It appears to me that I would then need to call a function and then run it in the body tag (onload type of call). Any help is appreciated.
08-01-2002, 08:21 PM
In order to get a page to load its parent frameset you could use something basic like this:
if (document.location == top.document.location)
document.location = "frameset.htm"
This will load the frameset with the default page (stated in the frameset) into the "main" frame.
If the page you want loaded into the main frame is not the default page then you require something a little more elaborate.
I use on my site a script that makes sure that if a page is loaded out of a frame it loads its parent frameset with itself in the main frame
Take a look at:
When the page above loads it will load its parent frameset with itself in the main frame even though the default page normally loaded by the frameset is different.
Let me know if you need further help with the script.
You can contact me through the website.
08-02-2002, 12:54 PM
I'm currently using this as the frame code within which I would like th epage to open up within the 'main' frame.
<frameset rows="20%,*" border="0" frameborder="0">
<frame name="header" src="header.htm" marginwidth="5" marginheight="5" scrolling="no" frameborder="1">
<frameset cols="25.5%,*" border="1">
<frame name="navigation" src="navigation.htm" marginwidth="5" marginheight="5" scrolling="auto" frameborder="0">
<frame name="main" src="main.htm" marginwidth="5" marginheight="5" scrolling="auto" frameborder="0">
The solution you gave me works like the one I had posted earlier - when I go to the individual page URL it forces me back to the index page with the frames - it doesn't force the window to open with the page URL in the main frame with the navigation and header frames where they belong.
Currently looking at the code on the page you directed me to:
if (top.location.href.indexOf("framfram.htm") == -1)
top.location.href = "framfram.htm?loader2.htm&3";
I'll attempt to mod it to see if I can get the frames to load right...thanks for the help (and you don't have to stop if you know the proper order of making this happen...)!
08-02-2002, 08:00 PM
I have to apologise as it looks as though there is/was an error on my page.
This error meant that the script would not work as it should.
I have now corrected this.
I attach a zip file containing the following which I created from the information you supplied regarding your frameset.
If you open page2.htm or page3.htm directly they will load the frameset and themselves into the main frame.
Links.htm contains links to pages 1 to 3.
Page 1 one open as normal (not in frame)
Pages 2 & 3 will load the frameset and themselves into the main frame.
Hope I have got it right this time :)
08-02-2002, 08:35 PM
Thanks MrsG - the files work like a charm. I'll look at implementing this on the site.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.