PDA

View Full Version : change the url to seo friendly when using Tab Content script v2.0



paulnettitude
02-27-2013, 11:44 AM
1) Script Title: Tab Content script v2.0

2) Script URL (on DD): http://www.dynamicdrive.com/forums/showthread.php?57523-Ajax-Tabs-Content-Script-%28v-2-2%29&highlight=Tab+Content+script+v2.0

3) Describe problem:Hi is it possible to change the url to SEO friendly i.e remove the query string ?sometext=sometext to /sometext when accessing the tabs via a remote link ?

jscheuer1
02-27-2013, 03:22 PM
That's not going to be SEO friendly unless there is a page at the address that you want the search engine to crawl to. In any case, you can have any URL you like as the href. Change (from "Dynamically selecting a tab using a remote link" on http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/ajaxtabs_suppliment.htm):


<a href="target.htm?flowertabs=1">Target Page</a>

to:


<a href="whatever.htm" onclick="window.location = 'target.htm?flowertabs=1'; return false;">Target Page</a>

Ideally the whatever.htm page would be the page that would get loaded into the content division. In the case of this example:


<div id="flowertabs" class="modernbricksmenu2">
<ul>
<li><a href="external1.htm" rel="flowerdivcontainer" class="selected">Tab 1</a></li>
<li><a href="external2.htm" rel="flowerdivcontainer" rev="flowernote,flowernote2">Tab 2</a></li>
<li><a href="external3.htm" rel="flowerdivcontainer">Tab 3</a></li>
<li><a href="external5.htm" rel="flowerdivcontainer" rev="flowernote3">Tab 4</a></li>
<li><a href="http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/">Ajax Tabs script</a></li>
</ul>
</div>
<br style="clear: left" />

<script type="text/javascript">

var myflowers=new ddajaxtabs("flowertabs", "flowerdivcontainer")
myflowers.setpersist(true)
myflowers.setselectedClassTarget("link") //"link" or "linkparent"
myflowers.init()

</script>

it would be:



<a href="external2.htm" onclick="window.location = 'target.htm?flowertabs=1'; return false;">Target Page</a>

However, you would then want a script on external2.htm to load target.htm with external2.htm in its tab. So on external2.htm put:


<script type="text/javascript">
if(loacation.href.indexOf('/target.htm') < 0){
window.location.replace('target.htm?flowertabs=1');
}
</script>

In fact, if you have that, you should be able to skip the onclick event. Try it both ways to see what happens.

The browser cache may need to be cleared and/or the pages refreshed to see changes.

If you want more help, please include a link to the pages on your site that contain the problematic code so we can check it out.