内容简介:似乎pjax是您正在寻找的图书馆:翻译自:https://stackoverflow.com/questions/12359895/listening-to-browser-back-button-when-using-ajax-and-saving-the-html-data-as-an
我正在创建一个脚本,用于监听浏览器后退按钮并加载上一页.我是jquery和 javascript
(一个 php 人)的新手.在重新发明之前,我已经在整个网络上搜索了一个库.但是由于我在ajax链接中使用了很多参数,我无法使用这些库.我承认我的错误,因为我不知道如何使用这种复杂的系统.所以我在想如果创建一个系统如下.
// get the contents of a particular div and save as an object/associative array
// { hash : pageNumber, html : content}
function save_history(div){
var content = $(div).html();
// increment the page number and add hash tags to the URL
}
// Listen to the browser hash value change
$(window).bind('hashchange', function () {
hash = window.location.hash;
if(hashValue){
load_history(hashValue);
}
});
// Load data from history
function load_history(id){
// fetch the content based on the hashvalue
$(div).html(content);
}
使用它有什么问题吗?当许多内容被保存为对象时,这会使页面无响应或崩溃浏览器吗?如果它导致这样的问题,我不想浪费我的时间.
似乎pjax是您正在寻找的图书馆: https://github.com/defunkt/jquery-pjax
翻译自:https://stackoverflow.com/questions/12359895/listening-to-browser-back-button-when-using-ajax-and-saving-the-html-data-as-an
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Linux设备驱动程序
科波特 / 魏永明、耿岳、钟书毅 / 中国电力出版社 / 2006-1-1 / 69.00元
本书是经典著作《Linux设备驱动程序》的第三版。如果您希望在Linux操作系统上支持计算机外部设备,或者在Linux上运行新的硬件,或者只是希望一般性地了解Linux内核的编程,就一定要阅读本书。本书描述了如何针对各种设备编写驱动程序,而在过去,这些内容仅仅以口头形式交流,或者零星出现在神秘的代码注释中。 本书的作者均是Linux社区的领导者。Jonathan Corbet虽不是专职的内核......一起来看看 《Linux设备驱动程序》 这本书的介绍吧!