I need to remove the # from my URL so that the completed URL is example.com/sub-page-title instead of example.com/#sub-page-title.
I was able to get a repetative URL to go away using substr(31), 31 being the length of the URL including http://... but I'm sure that is not the ideal way to do this.
NOTE: I cannot have a page refresh.
On click, an external page is loaded into a div (which then slides into place)...once that is visible, I want the URL to reflect this (without #). That way going forward and hitting "Back" will bring the users to the actual page.
CODE:
$(document).ready(function(){
var hash = window.location.hash.substr(1);
var href = $('a.load').each(function(){
var href = $(this).attr('href');
});
$('a.load').click(function(){
var toLoad = $(this).attr('href')+' #project-details';
$('.wide-frame').animate({
left: -985,
duration: 'slow'
})
$('#project-details article').hide();
$('#project-details').fadeIn('normal',loadContent);
window.location.hash = $(this).attr('href').substr(31);
function loadContent() {
$('#project-details').load(toLoad,showNewContent)
}
function showNewContent() {
$('#project-details').show('normal');
$.getScript("<?php bloginfo('template_directory'); ?>/scripts/ajax-control.js");
}
return false;
});
});
I don't know if this is pertinent, but I am also using Hash history with jQuery BBQ for some other navigation features.