Solved

Frames Loading

Posted on 2000-03-16
10
252 Views
Last Modified: 2013-12-24
I am looking for a script or technique to ensure a frameset is loaded around a particular page whenever it is loaded. I have a site with frames and no frames in various sections. If a visitor searches from the top level of the site to a page designed to be nested in a frameset how do I ensure the page is alway in the desired frameset and not just the page on it's own?
0
Comment
Question by:legault40
  • 6
  • 3
10 Comments
 
LVL 5

Expert Comment

by:compmania
ID: 2626137
You would have to make an HTML file with the frameset content of the other pages but your problem would be that the frames would stick.
0
 
LVL 1

Expert Comment

by:calumscott
ID: 2627250
Your answer lies with the target= tag.

target="_self" allows the link to open in the same frame.
target="_top" opens the link in the whole window.
target="_blank" opens the link in a new window.
target="_parent" opens the link in the parent frame. (If you have a frameset within a frame, it uses the frame currently containing the frameset).

If you are going from non-frames to frames, don't do anything just link to your frames page.  If you are going from frames to non-frames specify target="_top".

When going from frames to more frames things get a bit tricky and you have to remember where all your frames came from.

You also have the capability to specify target="framename" and explicitly say which frame you want the page to open in.

The syntax for target is...

<a href="URL" target="target option">text</a>

Have fun!

C.
0
 

Author Comment

by:legault40
ID: 2636623
Not sure ny of the above suggestions is what I am after. Perhaps I can make it a bit clearer. What I am looking for is a frames checker technique. If an attempt is made to load a page without its corresponding frameset how can I make it always loads in the appropriate frameset. Lets say someone finds a link on a search engine and tries to link to a page within a frameset. Only the single page will load on it's own. I don't want to use a refresh tag as the page will try to reload the frameset over and over.
0
 
LVL 1

Expert Comment

by:calumscott
ID: 2636839
Ah, right.  I guess for that you will need some kind of Javascript redirection.  So if someone starts the page without it being in the frameset it automatically loads the frames page.  Unfortunately I have absolutely no idea what the code to do this is but I'll see what I can dig up for you.

But if you are designing a site from scratch there is a way to stop search engines from looking at certain files.  It is a parameter file that resides in the root of your site that search engine "spiders" always look for (and, to the best of my knowledge, respect).  Once again it'll take me a while to find out how this works.

C.
0
 
LVL 1

Expert Comment

by:calumscott
ID: 2636887
Here's a basic redirect.  If you can figure out how to test what the current page is, that is to say has the page been loaded into "_top" or a frame then you are sorted.  My Javascript ain't that good, sorry....

<html>
<body>
<script>
if(navigator.javaEnabled()==true)
{ w=java.awt.Toolkit.getDefaultToolkit().getScreenSize().width
h=java.awt.Toolkit.getDefaultToolkit().getScreenSize().height
}
else {w=629; h=469}
properties="width="+w+",height="+h;
window.open("framespage.htm")
</script>


<script language="javascript">

setTimeout("self.close();",1000)

</script>
</body>
</html>


Maybe someone else knows how to check what the active (_top) page is???

C.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Expert Comment

by:calumscott
ID: 2636950
Skip that last one its much easier....

<SCRIPT LANGUAGE="JavaScript">

if (window == top) top.location.href = "framespage.htm";

</script>


Have fun...
0
 
LVL 1

Accepted Solution

by:
calumscott earned 100 total points
ID: 2636979
Or of course combine the two to check that the browser is java enabled and then kick of the if (window == top) script.

You will of course need to put this code at the top of all of your pages that must be in framesets.

Let me know how you go.

C.
0
 

Author Comment

by:legault40
ID: 2636985
The last comment from calumscott is close however, if I put this code on all my body pages of the framed site, it will redirect me back to the top of the site with the default body home page if the page is loaded without it's frameset not the page I want to display. Definately on the right track.

I am searching the Javascript area as well for this solution.
0
 
LVL 1

Expert Comment

by:calumscott
ID: 2637117
What you would then have to do is to have a javascript page which loads pages into frames based on parameters passed from the original page.

But that would REALLY be testing my limited knowledge of Javascript!!!!

I'm sure there must be a PAQ on that.

C.
0
 

Author Comment

by:legault40
ID: 2637141
Looks like a tough question to get it 100% the way I am proposing. After checking this on the other web development areas seems there are several ways to aproach this but no one has perfected it yet.

Your solution is good and will do for the time being as it address the initial problem and prevents pages from being loaded without frames. I thank you for your valliant effort to help me solve this problem.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now