Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7677407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:24:56+00:00 2026-05-31T17:24:56+00:00

I am using a history.js plugin and would like to know how I can

  • 0

I am using a history.js plugin and would like to know how I can implement a / type of URL. Right now my code is:

//Check if url hash value exists (for bookmark)
$.history.init(pageload);   

//highlight the selected link
$('a[href=' + document.location.hash + ']').addClass('selected');

//Seearch for link with REL set to ajax
$('a[rel=ajax]').click(function () {

    //grab the full url
    var hash = this.href;

    //remove the # value
    hash = hash.replace(/^.*#/, '');

    //for back button
    $.history.load(hash);   

    //clear the selected class and add the class class to the selected link
    $('a[rel=ajax]').removeClass('selected');
    $(this).addClass('selected');

    //hide the content and show the progress bar
    $('#content').hide();
    $('#loading').show();

    //run the ajax
    getPage();

    //cancel the anchor tag behaviour
    return false;
}); 



function pageload(hash) {
    //if hash value exists, run the ajax
    if (hash) getPage();    
}



function getPage() {

//generate the parameter for the php script
var data = 'page=' + document.location.hash.replace(/^.*#/, '');
$.ajax({
    url: "route.php",  
    type: "GET",        
    data: data,     
    cache: false,
    success: function (html) {  

        //hide the progress bar
        $('#loading').hide();   

        //add the content retrieved from ajax and put it in the #content div
        $('#content').html(html);

        //display the body with fadeIn transition
        $('#content').fadeIn('slow');       
    }       
});
}

The URL is always http://localhost/test/index.php#page1 but I would like to know how to make it http://localhost/test/page1.

I don’t want it to show the index.php part either, I need it just like the URL above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:24:57+00:00Added an answer on May 31, 2026 at 5:24 pm

    This can only be done using HTML5 and history.pushState().

    That API allows you to change the displayed URL (so long as it’s in the same domain) without triggering a page load. You can then use AJAX to change the displayed content instead.

    To see it in action, browse any source tree on github.com – they use the technique to “slide in” the source code as you browse the files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

JMVC has a History plugin that lets you interact the URL's hash fragment. For
I just finished implementing the history plugin for URL back button functionality and now
I'm using jQuery BlockUI Plugin and I'd like to do Javascript:history back(); after Click
I'm using window.onback = history.forward(); to prevent users from resubmitting data. I know it's
Possible Duplicate: History of changes to a particular line of code in Subversion? Using
I'm using Gallerific with history plugin. In the while loop where I print all
I am using this plugin: http://plugins.jquery.com/project/history on this page: http://www.crtaci.info/index.php?autocom=majice I dont know why
I'm using the BBQ jquery plugin for AJAX history management, but I'm having a
I have setup some tabs using jquery tools and the history plugin. When i
I'm using jquery.history lugin found here: http://tkyk.github.com/jquery-history-plugin/ With this i load content into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.