Jump to content
Lorne

Issue with html tabs and google searches

Recommended Posts

I have a web site that uses tabs to load web pages into the contents area of the screen with a vertical menu on the left and a header across the top.  It works fine if users load the index page but google shows links to pages that should only show in the content pane so if users click these links they load without the tab menu or header.  How can I detect if one of these pages has been loaded directly and redirect it to the index file ?

If you want to see the problem https://www.cantab.net/users/bridge.analyser/Bridge/index.html loads the page correctly but https://www.cantab.net/users/bridge.analyser/Bridge/home.htm is what the user gets clicking a google result that is not the index file, so I want to redirect the second link to the index page but only if the user did not load the index page first.  I know how to do the redirect but I can't work out how to detect how the user got to the page so it only redirects when it needs to.

Share this post


Link to post
Share on other sites

If the content appears in both it will be marked as duplicate content and frowned upon  by google.

Else If page is the address with home.html redirect to address with index and set it to 301 permanent. You could also use attribute rel with nofollow.

Share this post


Link to post
Share on other sites

Sorry I do not understand what you are saying.  It is a tab menu so clicking a tab loads the relevant html page into the tabcontents area of the page. I can't redirect the home page to the index page without a conditional statement because the index page loads the home page when the user click 'home' in the menu and it will keep reloading if there is no conditional statement to only go to the index page when the home page (or any other page that can be loaded via the menu) is loaded directly and not within the overall framework of the index file.

Share this post


Link to post
Share on other sites

I found a solution that works - I put this script in the <head> of each html page that has to be loaded in the tabcontent area of the page:

<script type="text/javascript">
  if (window.parent.document.title != 'Bridge Analyser') {
    location.replace('index.html');
  }
</script>

window.parent.document.title returns the title of the index page if the tabcontent was loaded by the index page but returns a different value if the user links directly to the tabcontent page instead of index.html.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...