Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a website in which i use tabs to navigate between pages. For example, page a displays A as an active tab and B and C background tabs. If the visitor gets to the website via page B, i also would like to display to page d, but not a and c.

Question: I know i can just create index2 for b for example, so when the visitor gets to b from a, i display a,b,c and index1 when visitor gets to b from d for example. Is that a bad practice? I know double content isn't good, but in which other way can i or should i approach this problem?

The tab navigation i designed uses < li > and id tag do display active tab, defined in the < body > tag.

share|improve this question
up vote 1 down vote accepted

You should probably be using url fragments to determine which tab gets shown. This will mean you only have a single page to work with.

A url fragment is the bit after a # symbol. For instance;

http://mysite.com/index.html#a http://mysite.com/index.html#b http://mysite.com/index.html#c

You could even use more descriptive fragment names if you wished.

Once you have these fragments in the URL you can use javascript (or jQuery) to show/hide the tabs.

The way I would construct this would be to "stack" the different tabs so they are all visible (one below the other). Then, when the page loads, use javascript to form them into the tabs and show/hide the relevant tab based on the url fragment.

The benefit is that if the visitor doesn't use javascript they will still be able to navigate the site and the page will 'jump' to the correct section automatically because of the fragment.

share|improve this answer
Thank you for your time and information. Very useful! – riseagainst Oct 25 '12 at 1:40
Although i must say, i never thought of using fragments in such way, only to specific sections of a page. Very interesting. – riseagainst Oct 26 '12 at 11:44

Each url should identify clearly a content, so depending on how much you care about usability, accessibility and related practices, you will choose one or other option.

Separated pages is the best option for many reasons, but is understandably that you want to use one and just hide content. If you choose to use one, you have easy control, as you mentioned, about the links, plus using cacheable images, the traffic is not going to be big.

If you choose to have one page, your best bet is to process the request with a server language and remove the content you don't want to show or just add what you want to show.

share|improve this answer
Thank you for your answer! – riseagainst Oct 25 '12 at 1:40
If removing or changing the content from the page server side you need to be extremely careful as this will effectively mean that different pages will be served under the same URL. A search engine won't properly index your content as everytime it hits the page the content will be different. Keeping everything on the page and showing/hiding based on a url fragment is not without potential issues but is, in my opinion far 'safer' than changing what is served to the browser. – foamcow Oct 25 '12 at 21:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.