Martijn
Martijn

Reputation: 24819

Jquery How to use history plugin?

In my web application I am using ajax and now I'd like the back and forward browser buttons to work. So I went looking for a jquery history plugin and found this one: http://stilbuero.de/jquery/history

In my code I use a function to load a page:

function loadDocument(id, doc) {
    $("#DocumentContent").show();

    // Clear dynamic menu items
    $("#DynamicMenuContent").html("");
    $("#PageContent").html("");

    // Load document in frame
    $("#iframeDocument").attr("src", 'ViewDoc.aspx?id=' + id + '&doc=' + doc + '');

    // Load menu items
    $("#DynamicMenuContent").load("ShowButtons.aspx");
}

As you can see I want my pages to load within an Iframe. Can someone tell me how I can use a history plugin so that the brwoser buttons will work? I don't really care which plugin it is, as long as the browser buttons work. I prefer an easy to use plugin.

Upvotes: 3

Views: 892

Answers (2)

tbranyen
tbranyen

Reputation: 8577

I was recently working on a web application that needed to maintain back and forward history for ajax content. I decided to go with Ben Alman's BBQ plugin found here: http://benalman.com/projects/jquery-bbq-plugin/

It is quite simple to use and he has several examples on how to implement it.

Upvotes: 1

Martijn
Martijn

Reputation: 24819

Since I am using an Iframe, the back and forward buttons are still working! I was under the impression that this wouldn't work because I use ajax, but it does work!

Upvotes: 0

Related Questions