简体   繁体   English

Jquery如何使用历史插件?

[英]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. 在我的Web应用程序中,我使用的是ajax,现在我希望后退和前进的浏览器按钮能够正常工作。 So I went looking for a jquery history plugin and found this one: http://stilbuero.de/jquery/history 所以我去寻找一个jquery历史插件,发现了这个: 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. 如您所见,我希望我的页面在Iframe中加载。 Can someone tell me how I can use a history plugin so that the brwoser buttons will work? 有人能告诉我如何使用历史插件,以便brwoser按钮可以工作吗? I don't really care which plugin it is, as long as the browser buttons work. 只要浏览器按钮工作,我真的不关心它是哪个插件。 I prefer an easy to use plugin. 我更喜欢一个易于使用的插件。

I was recently working on a web application that needed to maintain back and forward history for ajax content. 我最近正在开发一个Web应用程序,需要维护ajax内容的前后历史记录。 I decided to go with Ben Alman's BBQ plugin found here: http://benalman.com/projects/jquery-bbq-plugin/ 我决定选择Ben Alman的BBQ插件: http//benalman.com/projects/jquery-bbq-plugin/

It is quite simple to use and he has several examples on how to implement it. 它使用起来非常简单,他有几个如何实现它的例子。

Since I am using an Iframe, the back and forward buttons are still working! 由于我使用的是iframe,后退和前进按钮仍然有效! I was under the impression that this wouldn't work because I use ajax, but it does work! 我的印象是,这不起作用,因为我使用ajax,但它确实有效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM