Solved

Frames Loading

Posted on 2000-03-16
10
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
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…

710 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