?
Solved

Frames Loading

Posted on 2000-03-16
10
Medium Priority
?
288 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
Suggested Courses

718 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