Solved

Subpages and Frames...

Posted on 1998-05-05
9
207 Views
Last Modified: 2013-12-25
When you first come to my site, I have three frames set up.  A banner up top, table of contents on the left, and the main on the right.  My question is this, is there anyway for me to access a subpage directly and have the frames load?  The reason I'm asking is because I'd like to submit my subpages to the search engines, and when the user clicks on the link, have the frames load, and then the subpage load in the main frame.  If this sounds confusing let me know.  Thanks for the help!
0
Comment
Question by:ingenito
  • 4
  • 3
  • 2
9 Comments
 

Author Comment

by:ingenito
Comment Utility
Here's another way of putting it.  The user searches on a search engine for videos.  They see a link to my site about Windows Videos.  How can I have the user click on the link and have the frames load with the Windows Video information and not just to my main page?  I am willing to use Javascript but I don't want a seperate frame source on each page (I have over 200 pages) nor do I want a cgi script to do it.  Is there any way to do this?
0
 
LVL 3

Accepted Solution

by:
percyn earned 250 total points
Comment Utility
Yes.
    You have to check the number of frames (frames.length) on each page and if the frames.length<1, then load the frameset by using location.href="myframeset.html"


0
 

Author Comment

by:ingenito
Comment Utility
I'm sorry, but I don't understand.  Are you saying to put this code on every 'content' page to check for the frames?  If you are, then wouldn't the location.href="myframeset.htm" load the main page? I'm very familiar with javascript.  If you could, an example would be great.
0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
It seems you could put something like this in each of your subpages:

--//--
<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="Javascript"><!--
      if(!self.parent) self.location.href = "myFrameset.htm";
    // --></SCRIPT>
  </HEAD>
  <BODY>
    ...
  </BODY>
</HTML>
--//--

Is this what you meant?

-julio
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Expert Comment

by:julio011597
Comment Utility
BTW, i guess this is what percyn also meant... but, shouldn't be: top.frames.length?
0
 
LVL 3

Expert Comment

by:percyn
Comment Utility
Yes,
    Check the top.frame.length and if it is <1, load up a frameset. How remember that you can load a frameset which loads one static page (like a menu) and another page which uses Script or CGI/ASP to accept a frame src as a passed parameter. Thus if you have 200 pages, you dont need 200 framesets, just one frameset, which can accept an argument to load any of the 200 frames.
0
 

Author Comment

by:ingenito
Comment Utility
Since I want the content pages to be submitted to the search engines, I can't have it be a CGI script.  I think I figured it out though, please tell me if this implementation is practical.

On each of the pages I have added this just before the body tag:

<script language="javascript">
<!--

if(!top.frames.length){
document.writeln('<frameset framespacing="0" border="false" frameborder="0" rows="65,*">');
document.writeln('  <frame name="banner" scrolling="no" noresize target="contents" src="../../banner.htm" marginwidth="0" marginheight="0">');
document.writeln('  <frameset cols="192,*">');
document.writeln('    <frame name="contents" target="main" src="../../contents.htm" scrolling="no" noresize marginwidth="0" marginheight="0">');
document.writeln('    <frame name="main" src="account.htm" scrolling="auto">');
document.writeln('  </frameset>');
main.location.href="account.htm";
}

<!-- end of script -->
</script>

Now, this seems to work perfectly in MSIE 4.0 but not Netscape.  Can someone tell me why?
0
 
LVL 3

Expert Comment

by:percyn
Comment Utility
top.frames.length is an int, not a boolean. Check for the exact value, i.e. 0,1,2,3, etc.



0
 

Author Comment

by:ingenito
Comment Utility
It still doesn't work, if you'd like the page URL is http://www.corporatetrain.com/software/accounting/account.htm

Please take a look and let me know if you can tell what's wrong...
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 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