Search code examples
jqueryajaxthemesuritumblr

URI changes without reload?


How did they accomplish this function in the theme, where you click on the permalink (eyeball) button the uri changes, with out a hash (#) How is this done? is it ajax? or something else.

I assume it's calling the page but no reload?

theme: http://thingslog-theme.tumblr.com/ (click the eyeball at the bottom of each post)

I'm stumped and help?


Solution

  • They use a code of this kind :

    $('a').click(function() {
        link = $(this).attr('href')
        history.pushState({}, '', link);
        $('#content').load('/content.php?url='+link)
        return false;
    })
    

    with the history pushstate function which allow you to add and modify the browser history entries.