Correct Frames Page Meta Tags

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?
LVL 3
d4jaj1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
d4jaj1Author Commented:
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
tecbuilderCommented:
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
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

d4jaj1Author Commented:
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
tecbuilderCommented:
Use self.history.replace("http://www.new-dimensions.net)" or document.history.replace("http://www.new-dimensions.net)" in the function.
0
d4jaj1Author Commented:
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
tecbuilderCommented:
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
tecbuilderCommented:
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
d4jaj1Author Commented:
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
tecbuilderCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.