Solved

Correct Frames Page Meta Tags

Posted on 1997-12-07
10
393 Views
Last Modified: 2013-12-25
How to I write a correct meta tag for the 'sub-pages' in a a Frames website?  For example, I have a domain name - www.mydomain.com which has three frames (navigation, Title, sub-pages).  I have META tags on all of my sub-pages so that they can be found by the search engines, but I DON'T what customers to go to those pages individually, i.e., www.mydomain.com/sub-form.htm -I wan't them to use the Frames page's navagation bar.

Is there a way to point the meta tags on the sub pages to my domain name's frames page, so that the search engines results display www.mydomain.com instead of www.mydomain.com/sub-form.htm -- regardless of which sub-page the search engine found?
0
Comment
Question by:d4jaj1
  • 6
  • 4
10 Comments
 
LVL 6

Accepted Solution

by:
tecbuilder earned 20 total points
ID: 1855863
Add this script into the header of each one of your framed pages.  This will check to see if you are in a framedpage and if not then it will load your page that contains the frameset info.

<SCRIPT LANGUAGE="JavaScript">
<!-- Hide script from older browsers
setTimeout ("changePage()", 3000);
function changePage() {
  if (self.parent.frames.length != 0) {
    if self.parent.location != 'http://www.mydomain.com'   // Check to see if the frames belong to you.
      self.parent.location=http://www.mydomain.com    // Go to page to create frames
  }
  else
   self.parent.location=http://www.mydomain.com     // No frames found so go to page to create frames
}
// end hiding contents -->
</SCRIPT>
0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1855864
I get an error with this script.  The error is '(' expected.  Here's the HTML from my page.

<head>
<title>HomeBase Activity Manager Upgrades</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<script language="JavaScript">  
<!-- Hide script from older browsers  setTimeout ("changePage()", 3000);  
function changePage()
 {  if (self.parent.frames.length != 0)
   {  if self.parent.location != 'http://www.new-dimensions.net' // Check to see if the frames belong to you.  
    self.parent.location=http://www.new-dimensions.net // Go to page to create frames  }
  else  self.parent.location=http://www.new-dimensions.net // No frames found so go to page to create frames  }  
// end hiding contents -->  
</script>
</head>

By the way, do my META tags go above or below this script?
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1855865
Use this script instead.  It fixes a couple of typeos that I had.  I also changed it to use the history.replace("http://www.new-dimensions.net") function which will replace the current URL in the history list with the one specified.  I think this is better for what you are wanting.  I am not sure how NS handles the specfied URLs in the function so if you get an error try removing the http://s.

<SCRIPT LANGUAGE="JavaScript">
<!-- Hide script from older browsers

setTimeout ("changePage()", 3000);
function changePage() {
      if (self.parent.frames.length = 0)
            history.replace("http://www.new-dimensions.net") // No frames found so go to page to create frames
      else {
            if (self.parent.location != 'http://www.new-dimensions.net') // Check to see if the frames belong to you.
                  history.replace("http://www.new-dimensions.net") // Go to page to create frames
      }
}

// end hiding contents -->
</SCRIPT>

0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1855866
Nope, that didn't work. I get an error - 'Function not support by this object.  Also, I don't see anu http://s in your code above.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1855867
Use self.history.replace("http://www.new-dimensions.net)" or document.history.replace("http://www.new-dimensions.net)" in the function.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Author Comment

by:d4jaj1
ID: 1855868
This still does not work - using self or document.  Also, I moved the " inside of the bracket, as in you last comment I think you accidentlly put it outside of the bracket.  I get the same "Object doesn't support..." error.  Could you please test your answer before you post it to this question? Thanks.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1855869
It did work on my computer, but I don't have immediate access to a server to load files to see what happens.

I did realize that I was making this much more difficult than it needed to be.  This should work for you.  Again, it does work on my machine.

<SCRIPT LANGUAGE="JavaScript">
<!-- Hide script from older browsers
setTimeout ("changePage()", 3000);

function changePage() {
if (self.parent.frames.length == 0)
  window.location="http://www.new-dimensions.net";
}

// end hiding contents -->
</SCRIPT>
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1855870
You also asked about where do META tags go.  They can be anywhere in the Heading.  I usually put them just after the <head> tag so they are easier to find.  There is no problem if you want META tags before or after JavaScript.
0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1855871
Your last example seems to work and I will give you an A.  I do have two questions - just so I know what the code you gave me is actually doing.  The first part:

<!-- Hide script from older browsers
setTimeout ("changePage()", 3000);

What does this mean? Does it mean for browsers that don't support JAVA it won't change the page?  How would it know and would a run-time error dialog box appear?  What happens on browers that DO support JAVA, but simply have JAVA scripts turned off?

Secondly,

function changePage() {
if (self.parent.frames.length == 0)
window.location="http://www.new-dimensions.net";
}

The page acually loads - sits there for about 2 seconds, then redirects the user to the fames page.  Is ther a way not to load the page at all or make the redirect a little faster?  I tried to change the timeout - but that didn't work.

Those are my two qustions. I would like to make this alot better by redirecting the user to the frames page - without them seeing the sub-form and make the HTML page they initaillly visited teh active page in teh Frames form (as if ther had clickked the link with the frames form themselves).  I only want to implement this solution though if Netscape 3 & IE 3 and above can use it - so if these browsers don't support the answer you would give - I don't need it.  Finally - of course I would raise the points for the additional questions.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1855872
I'm glad what I sent worked for you.  I don't know why I was making it out to be so difficult.  My apologies.  The answer's to your questions are:

1) <!-- Hide script from older browsers
setTimeout ("changePage()", 3000);

>>What does this mean?<<
'<!--' is used just after the <script> tag for those browsers that don't recognize scripts.  This in effect comments all of your code.  If you don't those browsers are going to display all of your scripts on their window.  Ugly.  Also, just before the </script> tag you need the '// -->' [note: don't use the single quotes].  This ends the comment.

The setTimeout function says to wait 3000 milliseconds and then execute the function changePage.

>>Does it mean for browsers that don't support JAVA it won't change the page?  How would it know and would a run-time error dialog box appear?<<
No.  It has nothing to do with Java.  Browser either can or cannot run Java.  Those that can't, whether they unselected the option or they have an old or a text browser won't do anything.  No run-time error box will appear.
 
>>What happens on browers that DO support JAVA, but simply have JAVA scripts turned off?<<
The code won't work.  If you want a work always solution then you will need to do it at the server via CGI, Perl, or server-side JavaScript (aka LiveWire).  This answer was for the client-side JavaScript.  There is no way of getting around this at the client-side.

2) function changePage() {
     if (self.parent.frames.length == 0)
     window.location="http://www.new-dimensions.net";
   }

>>The page acually loads - sits there for about 2 seconds, then redirects the user to the fames page. Is ther a way not to load the page at all or make the redirect a little faster?<<
To speed this up decrease the number of milliseconds in the setTimeOut function.  For your situation, you may be able to make this a pretty small number say 500 or so.  How much of a pause you need will have to come via trial-and-error.  I would start out with 500 and see how everything works.  Keep decreasing the number until it doesn't.  Try to use a couple of different sped computers during testing.

>>I tried to change the timeout - but that didn't work.<<
This should have worked.  You may need to reload the page while it's waiting since the old page was in the cache and most likely being used.
0

Featured Post

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.

Join & Write a Comment

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
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:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

707 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

16 Experts available now in Live!

Get 1:1 Help Now